Fix null dereference in Workspace::workspaceEvent()
If Xcb::CurrentInput fails for some reason, the "->" operator will return null.
This commit is contained in:
parent
636cbbe024
commit
276baa7dd5
1 changed files with 14 additions and 12 deletions
|
@ -283,10 +283,11 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
|
|||
&& (event->detail == XCB_NOTIFY_DETAIL_NONE || event->detail == XCB_NOTIFY_DETAIL_POINTER_ROOT || event->detail == XCB_NOTIFY_DETAIL_INFERIOR)) {
|
||||
Xcb::CurrentInput currentInput;
|
||||
kwinApp()->updateXTime(); // focusToNull() uses xTime(), which is old now (FocusIn has no timestamp)
|
||||
if (!currentInput.isNull()) {
|
||||
// it seems we can "loose" focus reversions when the closing window hold a grab
|
||||
// => catch the typical pattern (though we don't want the focus on the root anyway) #348935
|
||||
const bool lostFocusPointerToRoot = currentInput->focus == kwinApp()->x11RootWindow() && event->detail == XCB_NOTIFY_DETAIL_INFERIOR;
|
||||
if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot)) {
|
||||
if (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot) {
|
||||
// kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ;
|
||||
Window *window = mostRecentlyActivatedWindow();
|
||||
if (window != nullptr) {
|
||||
|
@ -299,6 +300,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// fall through
|
||||
case XCB_FOCUS_OUT:
|
||||
return true; // always eat these, they would tell Qt that KWin is the active app
|
||||
|
|
Loading…
Reference in a new issue