[Qt-interest] SIGSEGV When Closing Child Top-Level Window

Josiah Bryan jbryan at productiveconcepts.com
Thu Nov 19 20:55:28 CET 2009


Josiah Bryan wrote:
> Odd problem when closing a child top-level QMainWindow (e.g. a secondary 
> mainwindow opened from a first main winodw). (This is with the Qt 4.6 RC 
> 1 - however, it also happens with previous versions of Qt as well - 
> stack trace is the same, but source paths are, of course, different.)
> 
> Steps are:
> 
> (A) MainWindow opens (B) SongEditorWindow opens (C) SlideEditorWindow.
> 
> Closing (C) is fine. However, when closing (B) after closing (C), 
> program segfaults with following stack trace. Odd thing is, it never 
> touches my code - its all in the event loop and QApplication. I've tried 
> all sorts of things - changing the destructor, not deleting (C) when 
> closed, calling deleteLater() on (C) when closed, etc. Nothing changes 
> the stacktrace when it crashes when (B) is closed.
> 
> HOWEVER - If I don't ever open (C), but just go (A)->(B), then close (B) 
> (without opening (C)) - it never crashes.
> 
> 
> But I can't find what in my code is causing the crash, since the 
> stacktrace doesn't even *hint* at whats wrong.
> 
> I checked the pointer that line #1 (below - the argument 
> (act=0xbff00a3c)) - and that is NOT the pointer to (B) or (C) (B ptr = 
> SongEditorWindow(0xd801270), C ptr = SlideEditorWindow(0xd9218f8)).
> 
> Any ideas, anyone? Thanks!

Oops - pasted the wrong stack trace from my file of problems. Here's the 
correct one corresponding to this problem:

(B) pointer = SongEditorWindow(0xc0caa50)
(C) pointer = SlideEditorWindow(0xc132e08)

The call in #1 below to setActiveWindow does not reference either (B) or 
(C).

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208882848 (LWP 28143)]
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x00c9e81b in QApplication::setActiveWindow (act=0xbff7fa5c) at 
kernel/qapplication.cpp:2442
#2  0x00d0f283 in QApplication::x11ProcessEvent (this=0xbff7fadc, 
event=0xbff7f75c) at kernel/qapplication_x11.cpp:3454
#3  0x00d3a119 in x11EventSourceDispatch (s=0x91e6c20, callback=0, 
user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#4  0x070b210c in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#5  0x070b554f in ?? () from /lib/libglib-2.0.so.0
#6  0x070b5ab5 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#7  0x0056eb48 in QEventDispatcherGlib::processEvents (this=0x91e1cf0, 
flags=@0xbff7f958) at kernel/qeventdispatcher_glib.cpp:407
#8  0x00d39f15 in QGuiEventDispatcherGlib::processEvents 
(this=0x91e1cf0, flags=@0xbff7f988) at 
kernel/qguieventdispatcher_glib.cpp:202
#9  0x0054049d in QEventLoop::processEvents (this=0xbff7fa00, 
flags=@0xbff7f9c8) at kernel/qeventloop.cpp:149
#10 0x0054082d in QEventLoop::exec (this=0xbff7fa00, flags=@0xbff7fa08) 
at kernel/qeventloop.cpp:201
#11 0x00542bb1 in QCoreApplication::exec () at 
kernel/qcoreapplication.cpp:981
#12 0x00c92cf7 in QApplication::exec () at kernel/qapplication.cpp:3603
#13 0x0807226a in main (argc=1, argv=0xbff7fb94) at main.cpp:22
(gdb) q




More information about the Qt-interest-old mailing list