Destroy static Client helper window before application goes down

Summary:
Client uses a static Xcb::Window helper. This so far didn't get
explicitly destroyed, so the application finalize cleaned it up.
To destroy the window the xcb_connection_t* is used which the
QGuiApplication already destroyed.

This change ensures that the window gets destroyed before the xcb
connection gets destroyed.

In addition an assert is added to KWin::connection() to ensure that
we still have the QGuiApplication::instance() when it's invoked.
This way we'll notice if we have more cases where we call into xcb
after the application went down.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1573
icc-effect-5.14.5
Martin Gräßlin 2016-05-09 16:01:49 +02:00
parent 24bdfc6317
commit ea4de85553
4 changed files with 9 additions and 0 deletions

View File

@ -630,6 +630,11 @@ void Client::updateShape()
static Xcb::Window shape_helper_window(XCB_WINDOW_NONE);
void Client::cleanupX11()
{
shape_helper_window.reset();
}
void Client::updateInputShape()
{
if (hiddenPreview()) // Sets it to none, don't change

View File

@ -355,6 +355,8 @@ public:
**/
void showOnScreenEdge();
static void cleanupX11();
public Q_SLOTS:
void closeWindow() override;
void updateCaption();

View File

@ -144,6 +144,7 @@ KWIN_EXPORT xcb_connection_t *connection()
if (!s_con) {
s_con = reinterpret_cast<xcb_connection_t*>(qApp->property("x11Connection").value<void*>());
}
Q_ASSERT(qApp);
return s_con;
}

View File

@ -448,6 +448,7 @@ Workspace::~Workspace()
m_allClients.removeAll(c);
desktops.removeAll(c);
}
Client::cleanupX11();
for (UnmanagedList::iterator it = unmanaged.begin(), end = unmanaged.end(); it != end; ++it)
(*it)->release(ReleaseReason::KWinShutsDown);
xcb_delete_property(connection(), rootWindow(), atoms->kwin_running);