Don't leak DrKonqi dialog / fix crash on wayland
ClosedPublic

Authored by davidedmundson on Apr 8 2020, 10:26 PM.

Details

Summary

When a QApplication is in it's destructor it calls window->destroy()
on all remaining QWindows. This deletes the platform window, whilst
keeping the real object alive. QtWayland doesn't like this.

Deleting the dialog fixes the issue. The deleteLater is fine because
QCoreApplication teardown is magic.

Test Plan

crashTest

Diff Detail

Repository
R871 DrKonqi
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 24969
Build 24987: arc lint + arc unit
davidedmundson created this revision.Apr 8 2020, 10:26 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 8 2020, 10:26 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Apr 8 2020, 10:26 PM
davidedmundson added a comment.EditedApr 8 2020, 10:35 PM

From before

Thread 1 "drkonqi" hit Breakpoint 1, 0x00007f0664dd8570 in QtWaylandClient::QWaylandDisplay::handleWindowDeactivated(QtWaylandClient::QWaylandWindow*)@plt ()
   from /opt/qt5/plugins/wayland-shell-integration/libxdg-shell.so
(gdb) bt
#0  0x00007f0664dd8570 in QtWaylandClient::QWaylandDisplay::handleWindowDeactivated(QtWaylandClient::QWaylandWindow*)@plt ()
   from /opt/qt5/plugins/wayland-shell-integration/libxdg-shell.so
#1  0x00007f0664dd9616 in QtWaylandClient::QWaylandXdgSurface::Toplevel::~Toplevel (this=0x55a21b293150, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp:72
#2  0x00007f0664dd9696 in QtWaylandClient::QWaylandXdgSurface::Toplevel::~Toplevel (this=0x55a21b293150, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp:81
#3  0x00007f0664dda57b in QtWaylandClient::QWaylandXdgSurface::~QWaylandXdgSurface (this=0x55a21b235190, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp:262
#4  0x00007f0664dda61c in QtWaylandClient::QWaylandXdgSurface::~QWaylandXdgSurface (this=0x55a21b235190, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp:270
#5  0x00007f066997f261 in QtWaylandClient::QWaylandWindow::reset (this=0x55a21b2920a0, sendDestroyEvent=false) at /home/david/projects/qt5/qtwayland/src/client/qwaylandwindow.cpp:243
#6  0x00007f066997e3d6 in QtWaylandClient::QWaylandWindow::~QWaylandWindow (this=0x55a21b2920a0, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/client/qwaylandwindow.cpp:94
#7  0x00007f066582325b in QtWaylandClient::QWaylandEglWindow::~QWaylandEglWindow (this=0x55a21b2920a0, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp:73
#8  0x00007f0665823284 in QtWaylandClient::QWaylandEglWindow::~QWaylandEglWindow (this=0x55a21b2920a0, __in_chrg=<optimized out>)
    at /home/david/projects/qt5/qtwayland/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp:84
#9  0x00007f066e1199e0 in QWindowPrivate::destroy (this=0x55a21b1a8790) at /home/david/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:2000
#10 0x00007f066e11979a in QWindow::destroy (this=0x55a21b23ed00) at /home/david/projects/qt5/qtbase/src/gui/kernel/qwindow.cpp:1949
#11 0x00007f066f395166 in QWidgetPrivate::deleteTLSysExtra (this=0x55a21b1a9b40) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:1697
#12 0x00007f066f3b1c1d in QWidget::destroy (this=0x55a21b0d4a30, destroyWindow=true, destroySubWindows=true) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qwidget.cpp:12148
#13 0x00007f066f35399e in QApplication::~QApplication (this=0x7fff1c38d830, __in_chrg=<optimized out>) at /home/david/projects/qt5/qtbase/src/widgets/kernel/qapplication.cpp:730
#14 0x000055a2197f3a22 in main (argc=11, argv=0x7fff1c38d9b8) at /home/david/projects/kde5/src/kde/workspace/drkonqi/src/main.cpp:228
anthonyfieroni added inline comments.
src/main.cpp
67

Adding a qApp as a parent here?

davidedmundson added inline comments.Apr 9 2020, 8:54 AM
src/main.cpp
67

I can't, qwidgets only take qwidgets as parents.

sitter accepted this revision.Apr 9 2020, 9:43 AM
This revision is now accepted and ready to land.Apr 9 2020, 9:43 AM
This revision was automatically updated to reflect the committed changes.