[wayland] Unload all effects prior to destroying Xwayland connection

Some effects do X11 calls in their cleanup code through external
libraries (e.g. KSelectionOwner). As we cannot control that we need
to ensure the effects are unloaded prior to destroying the Xwayland
connection.
icc-effect-5.14.5
Martin Gräßlin 2015-11-12 11:29:56 +01:00
parent 7b459214d9
commit c1e9280efa
4 changed files with 17 additions and 1 deletions

View File

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "kwin_wayland_test.h"
#include "../../abstract_backend.h"
#include "../../effects.h"
#include "../../wayland_server.h"
#include "../../workspace.h"
#include "../../xcbutils.h"
@ -52,6 +53,10 @@ WaylandTestApplication::~WaylandTestApplication()
{
destroyWorkspace();
waylandServer()->dispatch();
// need to unload all effects prior to destroying X connection as they might do X calls
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
}
if (x11Connection()) {
Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT);
destroyAtoms();

View File

@ -315,6 +315,11 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
}
EffectsHandlerImpl::~EffectsHandlerImpl()
{
unloadAllEffects();
}
void EffectsHandlerImpl::unloadAllEffects()
{
makeOpenGLContextCurrent();
if (keyboard_grab_effect != NULL)

View File

@ -62,7 +62,7 @@ class EffectLoader;
class Unmanaged;
class ScreenLockerWatcher;
class EffectsHandlerImpl : public EffectsHandler
class KWIN_EXPORT EffectsHandlerImpl : public EffectsHandler
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Effects")
@ -206,6 +206,7 @@ public:
void reloadEffect(Effect *effect) override;
QStringList loadedEffects() const;
QStringList listOfEffects() const;
void unloadAllEffects();
QList<EffectWindow*> elevatedWindows() const;
QStringList activeEffects() const;

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <config-kwin.h>
// kwin
#include "abstract_backend.h"
#include "effects.h"
#include "wayland_server.h"
#include "xcbutils.h"
@ -76,6 +77,10 @@ ApplicationWayland::~ApplicationWayland()
{
destroyWorkspace();
waylandServer()->dispatch();
// need to unload all effects prior to destroying X connection as they might do X calls
if (effects) {
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
}
if (x11Connection()) {
Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT);
destroyAtoms();