Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/ddeintegration/xdgactivation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

#include "xdgactivation.h"

#include <QCoreApplication>

Check warning on line 7 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QCoreApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QEventLoop>

Check warning on line 8 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QEventLoop> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QPointer>

Check warning on line 9 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QPointer> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTimer>

Check warning on line 10 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTimer> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QWindow>

Check warning on line 11 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QWindow> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QLoggingCategory>

Check warning on line 12 in src/ddeintegration/xdgactivation.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QLoggingCategory> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <private/qwaylandwindow_p.h>
#include <private/qwaylanddisplay_p.h>
Expand Down Expand Up @@ -37,8 +39,16 @@

XdgActivationV1 *XdgActivationV1::instance()
{
static XdgActivationV1 s_instance;
return &s_instance;
// Not a function-local static: a static is destroyed at process exit, after
// ~QGuiApplication has dropped the Wayland connection, so destroy() in the
// destructor would marshal onto a freed wl_proxy and crash. Parent to qApp so
// it's torn down with the Qt object tree instead.
static QPointer<XdgActivationV1> s_instance;
if (!s_instance) {
s_instance = new XdgActivationV1;
s_instance->setParent(qApp);
}
return s_instance;
}

XdgActivationV1::XdgActivationV1()
Expand All @@ -48,7 +58,9 @@

XdgActivationV1::~XdgActivationV1()
{
if (isInitialized())
// Runs only at shutdown, when qApp and the Wayland connection may already be
// gone; guard so we never send destroy() onto a dead wl_display.
if (qApp && isInitialized())
destroy();
}

Expand Down
Loading