Commit 6da991c7 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Don't crash when getting an invalid window in SelectionRequest.

parent 0a1f9bec
......@@ -2298,6 +2298,11 @@ static int is_atom_error( Display *display, XErrorEvent *event, void *arg )
return (event->error_code == BadAtom);
}
static int is_window_error( Display *display, XErrorEvent *event, void *arg )
{
return (event->error_code == BadWindow);
}
/**************************************************************************
* X11DRV_CLIPBOARD_InsertSelectionProperties
*
......@@ -3439,6 +3444,8 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
TRACE("\n");
X11DRV_expect_error( display, is_window_error, NULL );
/*
* We can only handle the selection request if :
* The selection is PRIMARY or CLIPBOARD, AND we can successfully open the clipboard.
......@@ -3527,6 +3534,8 @@ END:
TRACE("Sending SelectionNotify event...\n");
XSendEvent(display,event->requestor,False,NoEventMask,(XEvent*)&result);
}
XSync( display, False );
if (X11DRV_check_error()) WARN( "requestor %lx is no longer valid\n", event->requestor );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment