Ensure the Compositor does not start during termination
Summary: The SceneOpenGLES test was starting to randomly crash on my system. On investigation I observed that there was a graphics reset ("Attempting to reset compositing.") which triggered a delayed restart of the compositor. This even was only processed while waiting for XWayland to terminate. Which resulted in a crash in KWin::getXServerVersion as the xcb connection broke. It makes no sense to setup the compositor again during application shutdown. Thus the dtors set a flag that they are terminating the application and Compositor::setup is checking for it. Test Plan: Test no longer crashes, although it goes through the crashing path Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18015
This commit is contained in:
parent
99df3c82f3
commit
c2c92fab51
5 changed files with 16 additions and 0 deletions
|
@ -76,6 +76,7 @@ WaylandTestApplication::WaylandTestApplication(OperationMode mode, int &argc, ch
|
||||||
|
|
||||||
WaylandTestApplication::~WaylandTestApplication()
|
WaylandTestApplication::~WaylandTestApplication()
|
||||||
{
|
{
|
||||||
|
setTerminating();
|
||||||
kwinApp()->platform()->setOutputsEnabled(false);
|
kwinApp()->platform()->setOutputsEnabled(false);
|
||||||
// need to unload all effects prior to destroying X connection as they might do X calls
|
// need to unload all effects prior to destroying X connection as they might do X calls
|
||||||
// also before destroy Workspace, as effects might call into Workspace
|
// also before destroy Workspace, as effects might call into Workspace
|
||||||
|
|
|
@ -156,6 +156,10 @@ Compositor::~Compositor()
|
||||||
|
|
||||||
void Compositor::setup()
|
void Compositor::setup()
|
||||||
{
|
{
|
||||||
|
if (kwinApp()->isTerminating()) {
|
||||||
|
// don't setup while KWin is terminating. An event to restart might be lingering in the event queue due to graphics reset
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (hasScene())
|
if (hasScene())
|
||||||
return;
|
return;
|
||||||
if (m_suspended) {
|
if (m_suspended) {
|
||||||
|
|
9
main.h
9
main.h
|
@ -188,6 +188,10 @@ public:
|
||||||
return m_platform;
|
return m_platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isTerminating() const {
|
||||||
|
return m_terminating;
|
||||||
|
}
|
||||||
|
|
||||||
static void setupMalloc();
|
static void setupMalloc();
|
||||||
static void setupLocalizedString();
|
static void setupLocalizedString();
|
||||||
|
|
||||||
|
@ -231,6 +235,10 @@ protected:
|
||||||
}
|
}
|
||||||
void destroyAtoms();
|
void destroyAtoms();
|
||||||
|
|
||||||
|
void setTerminating() {
|
||||||
|
m_terminating = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_originalSessionKey;
|
QString m_originalSessionKey;
|
||||||
static int crashes;
|
static int crashes;
|
||||||
|
@ -252,6 +260,7 @@ private:
|
||||||
bool m_useKActivities = true;
|
bool m_useKActivities = true;
|
||||||
#endif
|
#endif
|
||||||
Platform *m_platform = nullptr;
|
Platform *m_platform = nullptr;
|
||||||
|
bool m_terminating = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline static Application *kwinApp()
|
inline static Application *kwinApp()
|
||||||
|
|
|
@ -129,6 +129,7 @@ ApplicationWayland::ApplicationWayland(int &argc, char **argv)
|
||||||
|
|
||||||
ApplicationWayland::~ApplicationWayland()
|
ApplicationWayland::~ApplicationWayland()
|
||||||
{
|
{
|
||||||
|
setTerminating();
|
||||||
if (!waylandServer()) {
|
if (!waylandServer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,7 @@ ApplicationX11::ApplicationX11(int &argc, char **argv)
|
||||||
|
|
||||||
ApplicationX11::~ApplicationX11()
|
ApplicationX11::~ApplicationX11()
|
||||||
{
|
{
|
||||||
|
setTerminating();
|
||||||
destroyCompositor();
|
destroyCompositor();
|
||||||
destroyWorkspace();
|
destroyWorkspace();
|
||||||
if (!owner.isNull() && owner->ownerWindow() != XCB_WINDOW_NONE) // If there was no --replace (no new WM)
|
if (!owner.isNull() && owner->ownerWindow() != XCB_WINDOW_NONE) // If there was no --replace (no new WM)
|
||||||
|
|
Loading…
Reference in a new issue