summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbclipboard.cpp
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2018-11-23 13:02:33 +0100
committerKirill Burtsev <kirill.burtsev@qt.io>2018-11-28 11:19:36 +0000
commitbd989d1652b8ad77088edbc7a68475dd1aabe52e (patch)
treefe9f8c5f6963209857c354715898646b530815b9 /src/plugins/platforms/xcb/qxcbclipboard.cpp
parent030b17ecc099ab3191b9b7a43a61560cf3d43f29 (diff)
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>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbclipboard.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 9c7559d514..bc92f82d5f 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -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