Page 1 of 2

SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Sun Mar 10, 2019 4:44 pm
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?

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Sun Mar 10, 2019 5:33 pm
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Mon Mar 11, 2019 1:48 am
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Mon Mar 11, 2019 2:47 pm
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 12:34 am
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)
{
}

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:51 am
by ONEEYEMAN
Hi,
What is your exact GTK+ version?

On both machines. ..

Thank you.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 2:09 pm
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

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:03 pm
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?

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:37 pm
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:43 pm
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:47 pm
by weswitt
Thanks for the help building the sample. Builds perfectly. Hopefully tonight I can test it out.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 3:51 pm
by ONEEYEMAN
NP.
Let us know if it crashes the same way as you test applications.

Thank you.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 4:54 pm
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.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Tue Mar 12, 2019 7:19 pm
by weswitt
Of course and I totally understand. I will repro with the sample as you suggest.

Re: SIGSEGV When calling wxFrame::ShowFullScreen

Posted: Thu Mar 14, 2019 4:43 pm
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.