Explicitly destroy plugins
A plugin may need to access kwinApp() or kwinApp()->platform() during tear down, but the problem is that plugins are destroyed after the kwinApp() object. The plugin manager must be destroyed explicitly while the application is still valid to ensure that no crash will occur during compositor teardown.icc-effect-5.26.4
parent
02c3dfb84b
commit
3a7bce693e
|
@ -79,6 +79,7 @@ WaylandTestApplication::~WaylandTestApplication()
|
||||||
if (effects) {
|
if (effects) {
|
||||||
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
|
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
|
||||||
}
|
}
|
||||||
|
destroyPlugins();
|
||||||
delete m_xwayland;
|
delete m_xwayland;
|
||||||
m_xwayland = nullptr;
|
m_xwayland = nullptr;
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
|
@ -131,7 +132,7 @@ void WaylandTestApplication::performStartup()
|
||||||
// try creating the Wayland Backend
|
// try creating the Wayland Backend
|
||||||
createInput();
|
createInput();
|
||||||
createBackend();
|
createBackend();
|
||||||
PluginManager::create(this);
|
createPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandTestApplication::createBackend()
|
void WaylandTestApplication::createBackend()
|
||||||
|
|
11
main.cpp
11
main.cpp
|
@ -17,6 +17,7 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "logind.h"
|
#include "logind.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "pluginmanager.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#include "screenlockerwatcher.h"
|
#include "screenlockerwatcher.h"
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
|
@ -296,6 +297,11 @@ void Application::createOptions()
|
||||||
options = new Options;
|
options = new Options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::createPlugins()
|
||||||
|
{
|
||||||
|
PluginManager::create(this);
|
||||||
|
}
|
||||||
|
|
||||||
void Application::installNativeX11EventFilter()
|
void Application::installNativeX11EventFilter()
|
||||||
{
|
{
|
||||||
installNativeEventFilter(m_eventFilter.data());
|
installNativeEventFilter(m_eventFilter.data());
|
||||||
|
@ -316,6 +322,11 @@ void Application::destroyCompositor()
|
||||||
delete Compositor::self();
|
delete Compositor::self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::destroyPlugins()
|
||||||
|
{
|
||||||
|
delete PluginManager::self();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::updateX11Time(xcb_generic_event_t *event)
|
void Application::updateX11Time(xcb_generic_event_t *event)
|
||||||
{
|
{
|
||||||
xcb_timestamp_t time = XCB_TIME_CURRENT_TIME;
|
xcb_timestamp_t time = XCB_TIME_CURRENT_TIME;
|
||||||
|
|
2
main.h
2
main.h
|
@ -210,10 +210,12 @@ protected:
|
||||||
void createWorkspace();
|
void createWorkspace();
|
||||||
void createAtoms();
|
void createAtoms();
|
||||||
void createOptions();
|
void createOptions();
|
||||||
|
void createPlugins();
|
||||||
void installNativeX11EventFilter();
|
void installNativeX11EventFilter();
|
||||||
void removeNativeX11EventFilter();
|
void removeNativeX11EventFilter();
|
||||||
void destroyWorkspace();
|
void destroyWorkspace();
|
||||||
void destroyCompositor();
|
void destroyCompositor();
|
||||||
|
void destroyPlugins();
|
||||||
/**
|
/**
|
||||||
* Inheriting classes should use this method to set the X11 root window
|
* Inheriting classes should use this method to set the X11 root window
|
||||||
* before accessing any X11 specific code pathes.
|
* before accessing any X11 specific code pathes.
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
// kwin
|
// kwin
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "pluginmanager.h"
|
|
||||||
#include "tabletmodemanager.h"
|
#include "tabletmodemanager.h"
|
||||||
|
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
@ -129,6 +128,7 @@ ApplicationWayland::~ApplicationWayland()
|
||||||
if (effects) {
|
if (effects) {
|
||||||
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
|
static_cast<EffectsHandlerImpl*>(effects)->unloadAllEffects();
|
||||||
}
|
}
|
||||||
|
destroyPlugins();
|
||||||
delete m_xwayland;
|
delete m_xwayland;
|
||||||
m_xwayland = nullptr;
|
m_xwayland = nullptr;
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
|
@ -158,7 +158,7 @@ void ApplicationWayland::performStartup()
|
||||||
InputMethod::create(this);
|
InputMethod::create(this);
|
||||||
createBackend();
|
createBackend();
|
||||||
TabletModeManager::create(this);
|
TabletModeManager::create(this);
|
||||||
PluginManager::create(this);
|
createPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationWayland::createBackend()
|
void ApplicationWayland::createBackend()
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <config-kwin.h>
|
#include <config-kwin.h>
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "pluginmanager.h"
|
|
||||||
#include "sm.h"
|
#include "sm.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "xcbutils.h"
|
#include "xcbutils.h"
|
||||||
|
@ -191,6 +190,7 @@ void ApplicationX11::setReplace(bool replace)
|
||||||
void ApplicationX11::lostSelection()
|
void ApplicationX11::lostSelection()
|
||||||
{
|
{
|
||||||
sendPostedEvents();
|
sendPostedEvents();
|
||||||
|
destroyPlugins();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
// Remove windowmanager privileges
|
// Remove windowmanager privileges
|
||||||
|
@ -249,7 +249,7 @@ void ApplicationX11::performStartup()
|
||||||
connect(platform(), &Platform::screensQueried, this,
|
connect(platform(), &Platform::screensQueried, this,
|
||||||
[this] {
|
[this] {
|
||||||
createWorkspace();
|
createWorkspace();
|
||||||
PluginManager::create(this);
|
createPlugins();
|
||||||
|
|
||||||
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
|
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue