Revert "Fix write to uninitialized bytes for XCB event"

This reverts commit 19c41bd095.

A more efficient fix is on the way.
This commit is contained in:
Enrico Forestieri 2020-02-25 12:32:10 +01:00
parent 9d8dfe934b
commit 8977296078

View File

@ -3352,26 +3352,18 @@ bool GuiApplication::nativeEventFilter(const QByteArray & eventType,
// not doing that, maybe because of our // not doing that, maybe because of our
// "persistent selection" implementation // "persistent selection" implementation
// (see comments in GuiSelection.cpp). // (see comments in GuiSelection.cpp).
xcb_selection_notify_event_t nev;
// It is expected that every X11 event is 32 bytes long, nev.response_type = XCB_SELECTION_NOTIFY;
// even if not all 32 bytes are needed. See: nev.requestor = srev->requestor;
// https://www.x.org/releases/current/doc/man/man3/xcb_send_event.3.xhtml nev.selection = srev->selection;
// TODO switch to Q_DECLARE_XCB_EVENT(event, xcb_selection_notify_event_t) nev.target = srev->target;
// once we require qt >= 5.6.3 or just copy the macro def. nev.property = XCB_NONE;
xcb_selection_notify_event_t *nev = (xcb_selection_notify_event_t*) calloc(32, 1); nev.time = XCB_CURRENT_TIME;
nev->response_type = XCB_SELECTION_NOTIFY;
nev->requestor = srev->requestor;
nev->selection = srev->selection;
nev->target = srev->target;
nev->property = XCB_NONE;
nev->time = XCB_CURRENT_TIME;
xcb_connection_t * con = QX11Info::connection(); xcb_connection_t * con = QX11Info::connection();
xcb_send_event(con, 0, srev->requestor, xcb_send_event(con, 0, srev->requestor,
XCB_EVENT_MASK_NO_EVENT, XCB_EVENT_MASK_NO_EVENT,
reinterpret_cast<char const *>(nev)); reinterpret_cast<char const *>(&nev));
xcb_flush(con); xcb_flush(con);
free(nev);
#endif #endif
return true; return true;
} }