Ubuntu16 GTK3 wxWindow::Show() crashes Topic is solved

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.
Post Reply
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Ubuntu16 GTK3 wxWindow::Show() crashes

Post by coderrc »

ETA:: wxWidgets version 3.1

I ran into an interesting problem this morning and I hope someone can explain it to me.

I have a good, fully functional global pointer to a wxWindow (the main app window in fact) called MainWindow
I have also a wxdialog called OutOfService that needs to be the only window on the screen. It basically reports that there is a hardware error and only goes away when the hardware is fixed.

when the OutOfService dialog is created it hides the main window with

Code: Select all

MainWindow->Hide();
When the OutOfService dialog is to be closed, it calls Close() and handles the event

in the wxEVT_CLOSE_WINDOW event handler for the OutOfService dialog, I attempt to simply show the main window and then destroy the dialog

Code: Select all

void OutOfService::OnCloseWindow(wxCloseEvent& event)
{
        MainWindow->Show();
       //destroy the window
	event.Skip();
}
I may have this backwards, but...
using Destroy() terminates the program cleanly
using event.Skip() throws a SIGTRAP

Code: Select all

Thread 28 "Hardware" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fffaa7fb700 (LWP 5808)]
0x00007fffedf29a6b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
#0  0x00007fffedf29a6b in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007fffedf29bdf in g_log () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffee23f068 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#3  0x00007fffee24a2d9 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#4  0x00007fffefd13c4d in _XError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007fffefcf7bd6 in XGetWindowProperty ()
   from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007fffee24d8de in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#7  0x00007fffee82a898 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#8  0x00007fffee82f451 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9  0x00007fffee82f952 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007fffea4a21d4 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007fffea4bc9a6 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007fffea4bd08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007fffee831b7c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#14 0x00007fffea4a1fa5 in g_closure_invoke ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007fffea4b3afc in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007fffea4bcd5c in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007fffea4bd08f in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x00007fffee821735 in gtk_widget_show ()
   from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007ffff2a9458d in wxWindow::Show(bool) ()
   from /usr/local/lib/libwx_gtk3u_core-3.1.so.0
#20 0x00007ffff2a8249d in wxTopLevelWindowGTK::Show(bool) ()
   from /usr/local/lib/libwx_gtk3u_core-3.1.so.0
#21 0x00000000007096cc in OutOfService::OnCloseWindow (this=0x2056700,     event=...) at OutOfService.cpp:297
#22 0x00007ffff23d65de in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const () from /usr/local/lib/libwx_baseu-3.1.so.0
#23 0x00007ffff254d997 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/local/lib/libwx_baseu-3.1.so.0
#24 0x00007ffff254e5c3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/local/lib/libwx_baseu-3.1.so.0
#25 0x00007ffff254eaa8 in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /usr/local/lib/libwx_baseu-3.1.so.0
#26 0x00007ffff254eb2a in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
   from /usr/local/lib/libwx_baseu-3.1.so.0
#27 0x00007ffff254ebb5 in wxEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/local/lib/libwx_baseu-3.1.so.0
#28 0x00007ffff254fb3c in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
   from /usr/local/lib/libwx_baseu-3.1.so.0
#29 0x00007ffff2c6c447 in wxWindowBase::Close(bool) ()
   from /usr/local/lib/libwx_gtk3u_core-3.1.so.0
#30 0x0000000000709000 in OutOfService::CloseDialog () at OutOfService.cpp:X
#31 0x00000000005376d8 in Machine::HardwareErrorRetry (this=0x1b0dcb0) at Machine.cpp:X
#32 0x000000000072e754 in HardwareThread::ThreadEntryRoutine (this=0x1b17a30)
    at HardwareThread.cpp:315
#33 0x000000000072cbe8 in HardwareThread::operator() (this=0x1b17a30)
    at HardwareThread.h:60
#34 0x000000000073a4f7 in boost::detail::thread_data<boost::reference_wrapper<HardwareThread> >::run (this=0x2019dc0)
    at /usr/local/include/boost/thread/detail/thread.hpp:136
#35 0x00007ffff44ad54d in thread_proxy ()
   from /usr/local/lib/libboost_thread.so.1.61.0
#36 0x00007ffff1bbb6ba in start_thread (arg=0x7fffaa7fb700)
    at pthread_create.c:333
#37 0x00007ffff18f182d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
	
	
(gdb) fr 21
#21 0x00000000007096cc in OutOfService::OnCloseWindow (this=0x2056700, 
    event=...) at OutOfService.cpp:297
297		if (MainWindow != nullptr) { MainWindow->Show(); }
(gdb) p MainWindow 
$1 = (wxTopLevelWindowGTK *) 0x1bbd720
:?: :?: :?:

I "fixed" the problem by moving the MainWindow->Show() out of the wxEVT_CLOSE_WINDOW event handler, but I am curious as to why I cannot do that in the handler.
actually it still doesnt work.
add "../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed." to the list of issues
Last edited by coderrc on Tue May 02, 2017 4:51 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Ubuntu16 GTK3 wxWindow::Show() crashes

Post by doublemax »

Are you calling OutOfService::CloseDialog() from the thread context?
Use the source, Luke!
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: Ubuntu16 GTK3 wxWindow::Show() crashes

Post by coderrc »

doublemax wrote:Are you calling OutOfService::CloseDialog() from the thread context?
No I am not, because I am a big fat stupid idiot.

Thanks so much man.
Post Reply