[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] /: Destroy static Client helper window before application goes down
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2016-05-17 12:22:36
Message-ID: E1b2e1E-00084s-DH () scm ! kde ! org
[Download RAW message or body]

Git commit ea4de855532d6905fc29b0a220b1e9b45e7ec7a1 by Martin Gräßlin.
Committed on 17/05/2016 at 12:17.
Pushed by graesslin into branch 'master'.

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

M  +5    -0    client.cpp
M  +2    -0    client.h
M  +1    -0    libkwineffects/kwinglobals.h
M  +1    -0    workspace.cpp

http://commits.kde.org/kwin/ea4de855532d6905fc29b0a220b1e9b45e7ec7a1

diff --git a/client.cpp b/client.cpp
index 5c49b16..2e69666 100644
--- a/client.cpp
+++ b/client.cpp
@@ -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
diff --git a/client.h b/client.h
index 7a28b54..08e25ab 100644
--- a/client.h
+++ b/client.h
@@ -355,6 +355,8 @@ public:
      **/
     void showOnScreenEdge();
 
+    static void cleanupX11();
+
 public Q_SLOTS:
     void closeWindow() override;
     void updateCaption();
diff --git a/libkwineffects/kwinglobals.h b/libkwineffects/kwinglobals.h
index 18b78f4..3ae0d36 100644
--- a/libkwineffects/kwinglobals.h
+++ b/libkwineffects/kwinglobals.h
@@ -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;
 }
 
diff --git a/workspace.cpp b/workspace.cpp
index a179a19..a179889 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -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);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic