SIGSEGV When calling wxFrame::ShowFullScreen

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

I'm seeing a Segmentation fault when calling wxFrame::ShowFullScreen:

#0 0x76a26714 in gdk_window_set_decorations () from /usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0
#1 0x0008233c in wxTopLevelWindowGTK::ShowFullScreen(bool, long) ()
#2 0x000966a4 in wxFrame::ShowFullScreen(bool, long) ()
#3 0x00061cec in wxHelper::ShowFrame (frame=0x1aebaf0) at wxhelper.cpp:56
#4 0x00042a9c in DisplayApp::OnInit (this=0x1ab9490) at displayapp.cpp:39
#5 0x002b6f18 in wxEntry(int&, wchar_t**) ()
#6 0x000429b0 in main (argc=3, argv=0x7e953c24) at displayapp.cpp:19

I'm using wxWidgets 3.0.4 on a Raspberry Pi using Raspbian:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.6 (stretch)
Release: 9.6
Codename: stretch

Is this a known bug?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by doublemax »

Please build and run the "display" sample that comes with wxWidgets. It has a menu entry "Full screen". Check if that crashes, top.
Use the source, Luke!
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

I will do that and report back.

One thing I have discovered is that this ONLY repros on a Pi with a 7" touch display that connects using the Pi ribbon display cable. Running on a Pi using HDMI display it work fine. So it seems that GTK is sensitive to the display driver.

Also, when I call the API I'm doing this: ShowFullScreen(true, wxFULLSCREEN_NOMENUBAR);, to disable any menubar.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by ONEEYEMAN »

Hi,
Are you running under X or Wayland?
Are running under GNOME or other WM?
What version of GTK+ do you have?

Thank you.
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

After more investigation I've found that the ShowFullScreen is unreliable. All of my tests were done with the sample code below -- the smallest wxWidgets app that shows an empty frame.

If ShowFullScreen() is used on a Raspberry Pi with a 7" LCD touchscreen it will segfault as follows:

#0 0x769fb714 in gdk_window_set_decorations () from /usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0
#1 0x00043b54 in wxTopLevelWindowGTK::ShowFullScreen(bool, long) ()
#2 0x000555d8 in wxFrame::ShowFullScreen(bool, long) ()
#3 0x0003a520 in TestApp::OnInit (this=0x800a88) at test.cpp:24
#4 0x0026a5f8 in wxEntry(int&, wchar_t**) ()
#5 0x0003a434 in main (argc=1, argv=0x7ee48c34) at test.cpp:15

If ShowFullScreen() is used on x86 but the X11 session is remote then it segfaults as follows:

#1 0x00007ffffe10d46e in gdk_x11_window_get_xid () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#2 0x000000000812ad68 in wxTopLevelWindowGTK::ShowFullScreen(bool, long) ()
#3 0x0000000008141c93 in wxFrame::ShowFullScreen(bool, long) ()
#4 0x00000000081139bf in TestApp::OnInit() (this=0x8a4c5d0) at test.cpp:33
#5 0x000000000837cc5f in wxEntry(int&, wchar_t**) ()
#6 0x00000000081138dc in main(int, char**) (argc=1, argv=0x7ffffffee8f8) at test.cpp:18

So it seems that there are at least 2 scenarios in which ShowFullScreen() fails, maybe there are more.

Sample App:

#include <wx/wx.h>

class TestApp : public wxApp
{
public:
virtual bool OnInit();
};

class TestFrame : public wxFrame
{
public:
TestFrame();
};

IMPLEMENT_APP(TestApp)

bool TestApp::OnInit()
{
if (!wxApp::OnInit())
{
return false;
}
TestFrame* frame = new TestFrame();
frame->ShowFullScreen(true);
return true;
}

TestFrame::TestFrame()
: wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(800,480), wxDEFAULT_FRAME_STYLE)
{
}
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by ONEEYEMAN »

Hi,
What is your exact GTK+ version?

On both machines. ..

Thank you.
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

I have 2.0 & 3.0 installed

sudo apt-get install libgtk2.0-0 -y
sudo apt-get install libgtk-3-0 -y
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by ONEEYEMAN »

Hi,
I understand, but I need an exact version(s) of the library as in 2.x.x and/or 3.x.x.
And how did you configure wxWidgets? What's an exact configure line you used? Were there any errors/warnings during configuring/building?

And finally, as doublemax suggested, are you able to build and execute display sample and then make the application full-screen?
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

GTK versions: 3.22.11-1+rpi3, 2.24.31-2

wxWidgets configure command: ../configure --enable-unicode --disable-shared

I was unable to get the sample compiled & running. Total PITA. Anyway the sample I provided is much simpler and clearly demonstrates the problem.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by ONEEYEMAN »

Hi,
There is absolutely no pain.

Code: Select all

cd wxWidgets/buildGTK/samples/display
make
./display
This presumes that you configured and built the library in wxWidgets/buildGTK.

Let us know if you are unable to build/execute the sample and if you are what is the error(s).

Thank you.
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

Thanks for the help building the sample. Builds perfectly. Hopefully tonight I can test it out.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by ONEEYEMAN »

NP.
Let us know if it crashes the same way as you test applications.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by doublemax »

Anyway the sample I provided is much simpler and clearly demonstrates the problem.
But: if the crash happens with an unmodified sample, you can open a bug report at http://trac.wxwidgets.org and whoever is looking into this, knows that the problem is not in your code. Even is your code is short, it still takes a considerable amount of time to check it line by line, just to make sure you didn't make a simple mistake.
Use the source, Luke!
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

Of course and I totally understand. I will repro with the sample as you suggest.
weswitt
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Dec 29, 2016 10:45 pm

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Post by weswitt »

OK, I was able to get the display sample running and repro the problem with the sample.

Running the sample unchanged it works fine. You launch the sample and then choose the "full screen" menu item and the app is properly displayed full screen. However, if you change the line that says "frame->Show()" to "frame->ShowFullScreen(true)" then it will segfault. If I add the line "frame->ShowFullScreen(true);" after the line "frame->Show();" such that initially the app is displayed windowed and then immediately change to full screen then it works. So the problem is that the frame cannot be shown full screen the first time.

Is this a known bug / limitation.
Post Reply