$OpenBSD: patch-qtbase_src_plugins_platforms_xcb_qxcbbackingstore_cpp,v 1.1 2015/01/15 11:10:02 zhuk Exp $
Fix use-after-free bug.
Upstream commit: https://qt.gitorious.org/qt/qtbase/commit/d40b66a8ef98777c69ac293dac9a332f88832c23
Bug report: https://bugreports.qt-project.org/browse/QTBUG-43623
--- qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp.ports.orig	Thu Jan 15 14:05:24 2015
+++ qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp	Thu Jan 15 14:05:42 2015
@@ -153,8 +153,6 @@ void QXcbShmImage::destroy()
     if (segmentSize && m_shm_info.shmaddr)
         Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg));
 
-    xcb_image_destroy(m_xcb_image);
-
     if (segmentSize) {
         if (m_shm_info.shmaddr) {
             shmdt(m_shm_info.shmaddr);
@@ -163,6 +161,8 @@ void QXcbShmImage::destroy()
             free(m_xcb_image->data);
         }
     }
+
+    xcb_image_destroy(m_xcb_image);
 
     if (m_gc)
         Q_XCB_CALL(xcb_free_gc(xcb_connection(), m_gc));
