summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbscreen.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-06-12 11:01:29 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2017-06-28 09:06:27 +0000
commit84cc43413a8577245701e6890d821e3c701a2fb1 (patch)
tree2bad35ff36cf9beaf56c838117b29be3d842f514 /src/plugins/platforms/xcb/qxcbscreen.cpp
parent634f28fa1fd2678d5b73b80367dc18acc929187e (diff)
Clean-up in QXcbScreen::getOutputProperty()
Use the Q_XCB_REPLY() macro and let its unique_ptr<> take care of free()ing the reply. Change-Id: I32eb9c56ea0ba5632bf6ab39c77567d10f442995 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 79f37bb028..d097ad79a8 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -861,17 +861,14 @@ QByteArray QXcbScreen::getOutputProperty(xcb_atom_t atom) const
{
QByteArray result;
- auto cookie =
- xcb_randr_get_output_property(xcb_connection(), m_output,
- atom, XCB_ATOM_ANY, 0, 100, false, false);
- auto reply = xcb_randr_get_output_property_reply(xcb_connection(), cookie, nullptr);
+ auto reply = Q_XCB_REPLY(xcb_randr_get_output_property, xcb_connection(),
+ m_output, atom, XCB_ATOM_ANY, 0, 100, false, false);
if (reply && reply->type == XCB_ATOM_INTEGER && reply->format == 8) {
quint8 *data = new quint8[reply->num_items];
- memcpy(data, xcb_randr_get_output_property_data(reply), reply->num_items);
+ memcpy(data, xcb_randr_get_output_property_data(reply.get()), reply->num_items);
result = QByteArray(reinterpret_cast<const char *>(data), reply->num_items);
delete[] data;
}
- free(reply);
return result;
}