Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.4.0
-
qtwayland's face202 and qtbase's 9b4fbe8
Description
Removing a screen can cause a pure virtual method to be called in QtQuick.
I can reproduce it only on wayland (5.4 branch of qtwayland), i suppose it doesn't happen on xcb because it moves the window before removing the screen, and i can't test on other platforms.
To reproduce launch a compositor with two outputs, e.g. "weston --output-count=2 "on X, and close the output containing the window of this test client:
import QtQuick.Window 2.1
Window {
width: Screen.width / 10
height: 100
}
The backtrace is as follows:
Program received signal SIGABRT, Aborted. 0x00007ffff4b55d67 in raise () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007ffff4b55d67 in raise () from /usr/lib/libc.so.6 #1 0x00007ffff4b57118 in abort () from /usr/lib/libc.so.6 #2 0x00007ffff544b1f5 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6 #3 0x00007ffff5449076 in ?? () from /usr/lib/libstdc++.so.6 #4 0x00007ffff54490c1 in std::terminate() () from /usr/lib/libstdc++.so.6 #5 0x00007ffff5449bff in __cxa_pure_virtual () from /usr/lib/libstdc++.so.6 #6 0x00007ffff6380c35 in QPlatformScreen::physicalSize (this=0x428e70) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qplatformscreen.cpp:150 #7 0x00007ffff63d8b7d in QScreen::physicalSize (this=0x42f260) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qscreen.cpp:253 #8 0x00007ffff63d8c36 in QScreen::physicalDotsPerInch (this=0x42f260) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qscreen.cpp:176 #9 0x00007ffff7baede4 in QQuickScreenAttached::screenChanged (this=0x95f8c0, screen=0x42f240) at /home/giulio/projects/qt5/qtdeclarative/src/quick/items/qquickscreen.cpp:307 #10 0x00007ffff7c5eccd in QQuickScreenAttached::qt_static_metacall (_o=0x95f8c0, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fffffffb960) at .moc/moc_qquickscreen_p.cpp:156 #11 0x00007ffff5fae53d in QMetaObject::activate (sender=0x964440, signalOffset=3, local_signal_index=0, argv=0x7fffffffb960) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3709 #12 0x00007ffff5fad9bd in QMetaObject::activate (sender=0x964440, m=0x7ffff6992568 <QWindow::staticMetaObject>, local_signal_index=0, argv=0x7fffffffb960) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3575 #13 0x00007ffff63a102f in QWindow::screenChanged (this=0x964440, _t1=0x42f240) at .moc/moc_qwindow.cpp:626 #14 0x00007ffff63a0eea in QWindowPrivate::emitScreenChangedRecursion (this=0x95c190, newScreen=0x42f240) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:374 #15 0x00007ffff63a11b3 in QWindowPrivate::setTopLevelScreen (this=0x95c190, newScreen=0x42f240, recreate=true) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:395 #16 0x00007ffff63a4266 in QWindow::setScreen (this=0x964440, newScreen=0x42f240) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:1694 #17 0x00007ffff63a0e84 in QWindow::screenDestroyed (this=0x964440, object=0x42f260) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:1704 #18 0x00007ffff63a7579 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QObject*>, void, void (QWindow::*)(QObject*)>::call (f= (void (QWindow::*)(QWindow * const, QObject *)) 0x7ffff63a0e10 <QWindow::screenDestroyed(QObject*)>, o=0x964440, arg=0x7fffffffc050) at /home/giulio/projects/qt5/qtbase/build/src/gui/../../include/QtCore/../../../src/corelib/kernel/qobjectdefs_impl.h:508 #19 0x00007ffff63a74d0 in QtPrivate::FunctionPointer<void (QWindow::*)(QObject*)>::call<QtPrivate::List<QObject*>, void> (f= (void (QWindow::*)(QWindow * const, QObject *)) 0x7ffff63a0e10 <QWindow::screenDestroyed(QObject*)>, o=0x964440, arg=0x7fffffffc050) at /home/giulio/projects/qt5/qtbase/build/src/gui/../../include/QtCore/../../../src/corelib/kernel/qobjectdefs_impl.h:527 ---Type <return> to continue, or q <return> to quit--- #20 0x00007ffff63a73f8 in QtPrivate::QSlotObject<void (QWindow::*)(QObject*), QtPrivate::List<QObject*>, void>::impl (which=1, this_=0x95c480, r=0x964440, a=0x7fffffffc050, ret=0x0) at /home/giulio/projects/qt5/qtbase/build/src/gui/../../include/QtCore/../../../src/corelib/kernel/qobject_impl.h:151 #21 0x00007ffff5fb285b in QtPrivate::QSlotObjectBase::call (this=0x95c480, r=0x964440, a=0x7fffffffc050) at /home/giulio/projects/qt5/qtbase/build/src/corelib/../../include/QtCore/../../../src/corelib/kernel/qobject_impl.h:132 #22 0x00007ffff5fae375 in QMetaObject::activate (sender=0x42f260, signalOffset=0, local_signal_index=0, argv=0x7fffffffc050) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3695 #23 0x00007ffff5fad9bd in QMetaObject::activate (sender=0x42f260, m=0x7ffff629bd50 <QObject::staticMetaObject>, local_signal_index=0, argv=0x7fffffffc050) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:3575 #24 0x00007ffff5fa56ac in QObject::destroyed (this=0x42f260, _t1=0x42f260) at .moc/moc_qobject.cpp:206 #25 0x00007ffff5fa4e00 in QObject::~QObject (this=0x42f260) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:907 #26 0x00007ffff63d89c2 in QScreen::~QScreen (this=0x42f260) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qscreen.cpp:85 #27 0x00007ffff63d8959 in QScreen::~QScreen (this=0x42f260) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qscreen.cpp:82 #28 0x00007ffff6380a42 in QPlatformScreen::destroy (this=0x428e70) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qplatformscreen.cpp:74 #29 0x00007ffff6380986 in QPlatformScreen::~QPlatformScreen (this=0x428e70) at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qplatformscreen.cpp:63 #30 0x00007fffee61f8f3 in QWaylandScreen::~QWaylandScreen (this=0x428e70) at /home/giulio/projects/qt5/qtwayland/src/client/qwaylandscreen.cpp:76 #31 0x00007fffee61f829 in QWaylandScreen::~QWaylandScreen (this=0x428e70) at /home/giulio/projects/qt5/qtwayland/src/client/qwaylandscreen.cpp:74 #32 0x00007fffee6171c5 in QWaylandDisplay::registry_global_remove (this=0x427da0, id=10) at /home/giulio/projects/qt5/qtwayland/src/client/qwaylanddisplay.cpp:270 #33 0x00007fffee617302 in non-virtual thunk to QWaylandDisplay::registry_global_remove(unsigned int) () at /home/giulio/projects/qt5/qtwayland/src/client/qwaylanddisplay.cpp:280 #34 0x00007fffee632dd0 in QtWayland::wl_registry::handle_global_remove (data=0x427db0, object=0x41f980, name=10) at qwayland-wayland.cpp:80 #35 0x00007fffeec21df0 in ffi_call_unix64 () from /usr/lib/libffi.so.6 #36 0x00007fffeec21861 in ffi_call () from /usr/lib/libffi.so.6 #37 0x00007fffee18066d in wl_closure_invoke (closure=<optimized out>, flags=<optimized out>, target=0x41f980, opcode=1, data=0x427db0) at src/connection.c:934 #38 0x00007fffee17d9eb in dispatch_event (display=display@entry=0x7fffe80035b0, queue=0x428450) at src/wayland-client.c:1122 #39 0x00007fffee17da6c in dispatch_queue (display=display@entry=0x7fffe80035b0, queue=queue@entry=0x428450) at src/wayland-client.c:1234 #40 0x00007fffee17e754 in wl_display_dispatch_queue_pending (display=0x7fffe80035b0, queue=0x428450) at src/wayland-client.c:1456 #41 0x00007fffee615b34 in QWaylandDisplay::flushRequests (this=0x427da0) at /home/giulio/projects/qt5/qtwayland/src/client/qwaylanddisplay.cpp:169 ---Type <return> to continue, or q <return> to quit--- #42 0x00007fffee63bc0b in QWaylandDisplay::qt_static_metacall (_o=0x427da0, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffe8007d70) at .moc/moc_qwaylanddisplay_p.cpp:73 #43 0x00007ffff5fa4153 in QMetaCallEvent::placeMetaCall (this=0x7fffe8007d90, object=0x427da0) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:489 #44 0x00007ffff5fa5fb9 in QObject::event (this=0x427da0, e=0x7fffe8007d90) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qobject.cpp:1249 #45 0x00007ffff6b0a6da in QApplicationPrivate::notify_helper (this=0x41c590, receiver=0x427da0, e=0x7fffe8007d90) at /home/giulio/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3729 #46 0x00007ffff6b0c770 in QApplication::notify (this=0x7fffffffe260, receiver=0x427da0, e=0x7fffe8007d90) at /home/giulio/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3172 #47 0x00007ffff5f58275 in QCoreApplication::notifyInternal (this=0x7fffffffe260, receiver=0x427da0, event=0x7fffe8007d90) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:940 #48 0x00007ffff5f5cfea in QCoreApplication::sendEvent (receiver=0x427da0, event=0x7fffe8007d90) at /home/giulio/projects/qt5/qtbase/build/src/corelib/../../include/QtCore/../../../src/corelib/kernel/qcoreapplication.h:236 #49 0x00007ffff5f5971a in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x41c470) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1544 #50 0x00007ffff5f58b7f in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1402 #51 0x00007ffff5ff2a4a in postEventSourceDispatch (s=0x450f40) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:279 #52 0x00007ffff440ab84 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #53 0x00007ffff440adc8 in ?? () from /usr/lib/libglib-2.0.so.0 #54 0x00007ffff440ae6c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #55 0x00007ffff5ff1786 in QEventDispatcherGlib::processEvents (this=0x429590, flags=...) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:426 #56 0x00007fffee63d8fd in QPAEventDispatcherGlib::processEvents (this=0x429590, flags=...) at /home/giulio/projects/qt5/qtbase/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp:123 #57 0x00007ffff5f53d5a in QEventLoop::processEvents (this=0x7fffffffdd10, flags=...) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:136 #58 0x00007ffff5f53f91 in QEventLoop::exec (this=0x7fffffffdd10, flags=...) at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qeventloop.cpp:212 #59 0x00007ffff5f58a25 in QCoreApplication::exec () at /home/giulio/projects/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1193 #60 0x00007ffff63917f6 in QGuiApplication::exec () at /home/giulio/projects/qt5/qtbase/src/gui/kernel/qguiapplication.cpp:1515 #61 0x00007ffff6b0bdc9 in QApplication::exec () at /home/giulio/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2964 ---Type <return> to continue, or q <return> to quit--- #62 0x0000000000405df2 in main (argc=2, argv=0x7fffffffe548) at /home/giulio/projects/qt5/qtdeclarative/tools/qmlscene/main.cpp:540 (gdb)
What happens here is that the QScreen is deleted in ~QPlatformScreen(), and QQuickScreen uses QScreen methods which call QPlatformScreen virtual functions from a slot of the QScreen destroyed() signal.