Application crashing in QWidgetPrivate::hideChildren(bool)
Hi All,
I am developing an application where i create a sub-window from the main-window layout and close the sub-window at run time. Sometimes on sub-window close i get an application crash as shown in the back trace:
Quote:
#0 0x42554550 in QWidgetPrivate::hideChildren(bool) () from /usr/lib/libQtGui.so.4
#1 0x425546b2 in QWidgetPrivate::hide_helper() () from /usr/lib/libQtGui.so.4
#2 0x42556970 in QWidget::setVisible(bool) () from /usr/lib/libQtGui.so.4
#3 0x4254cc00 in QWidgetPrivate::close_helper(QWidgetPrivate::Close Mode) ()
from /usr/lib/libQtGui.so.4
#4 0x42583f13 in QApplication::x11ClientMessage(QWidget*, _XEvent*, bool) ()
from /usr/lib/libQtGui.so.4
#5 0x42581b55 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#6 0x425ad455 in ?? () from /usr/lib/libQtGui.so.4
#7 0x4157faff in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#8 0x41580240 in ?? () from /lib/libglib-2.0.so.0
#9 0x415804ef in g_main_context_iteration () from /lib/libglib-2.0.so.0
#10 0x4226d418 in QEventDispatcherGlib::processEvents(QFlags<QEventL oop::ProcessEventsFlag>) ()
from /usr/lib/libQtCore.so.4
#11 0x425ad0eb in ?? () from /usr/lib/libQtGui.so.4
#12 0x42238fde in QEventLoop::processEvents(QFlags<QEventLoop::Proce ssEventsFlag>) ()
from /usr/lib/libQtCore.so.4
#13 0x42239289 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsF lag>) ()
from /usr/lib/libQtCore.so.4
#14 0x4223e72b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#15 0x424f6245 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#16 0x0805a749 in main (argc=3, argv=0xbffff2f4) at main.cpp:156
Is there a away to come out of this problem and avoid the application crash on sub-window close??
Re: Application crashing in QWidgetPrivate::hideChildren(bool)
I am still stuck with this issue and still facing the crash. Any updates on this??
Re: Application crashing in QWidgetPrivate::hideChildren(bool)
Can you provide a minimal compilable example that reproduces the problem ?
Re: Application crashing in QWidgetPrivate::hideChildren(bool)
Quote:
I am still stuck with this issue and still facing the crash. Any updates on this??
Are you deleting this subwindow when you close it? I can't tell what the back trace is saying (I work on Windows using MSVC), but if the method where the crash occurs is referencing an instance that has already been deleted, that would cause a crash.
If so, instead of deleting the subwindow instance, call deleteLater() through its pointer. In this case, the instance will ultimately be deleted only when control returns to the event loop.
If that doesn't fix it, then you probably have a coding error which has corrupted memory, and this crash is just a red herring - the result of something else messing up the object instance being used in the hideChildren() call. Crashes like this that occur way down inside of Qt code are almost never a Qt bug; something your code has done has messed things up.