xcb: free leaking clipboard events

The leak has been there since the beginnings of Qt 5.0.

Change-Id: I238181dcc63cb4cf8a60b5c565b184d8278d0315
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
bb10
Kirill Burtsev 2018-11-23 13:02:33 +01:00
parent 030b17ecc0
commit bd989d1652
1 changed files with 4 additions and 3 deletions

View File

@ -261,7 +261,9 @@ QXcbClipboard::~QXcbClipboard()
connection()->sync();
// waiting until the clipboard manager fetches the content.
if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, true)) {
if (auto event = waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, true)) {
free(event);
} else {
qWarning("QXcbClipboard: Unable to receive an event from the "
"clipboard manager in a reasonable time");
}
@ -838,6 +840,7 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb
if (!ge)
break;
xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge;
QScopedPointer<xcb_property_notify_event_t, QScopedPointerPodDeleter> guard(event);
if (event->atom != property
|| event->state != XCB_PROPERTY_NEW_VALUE
@ -869,8 +872,6 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb
} else {
break;
}
free(ge);
}
// timed out ... create a new requestor window, otherwise the requestor