Verify Workspace pointer in X11EventFilter::~X11EventFilter

In case the inheriting class of X11EventFilter is a child of
Workspace and deleted by the QObject dtor of Workspace the
Workspace::self() pointer is no longer valid and already set to
nullptr.
icc-effect-5.14.5
Martin Gräßlin 2014-11-25 12:57:37 +01:00
parent b7a8bb4f52
commit 7c62cd19ef
1 changed files with 3 additions and 1 deletions

View File

@ -32,7 +32,9 @@ X11EventFilter::X11EventFilter(int eventType, int opcode, int genericEventType)
X11EventFilter::~X11EventFilter()
{
Workspace::self()->unregisterEventFilter(this);
if (auto w = Workspace::self()) {
w->unregisterEventFilter(this);
}
}
}