src/gui/image/qnativeimage.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
--- a/src/gui/image/qnativeimage.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/image/qnativeimage.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -178,6 +178,8 @@
     if (ok) {
         xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0);
         xshminfo.shmaddr = xshmimg->data;
+        if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1)
+            qWarning() << "Error while marking the shared memory segment to be destroyed";
         ok = (xshminfo.shmaddr != (char*)-1);
         if (ok)
             image = QImage((uchar *)xshmimg->data, width, height, systemFormat());
@@ -199,10 +201,12 @@
             shmctl(xshminfo.shmid, IPC_RMID, 0);
         return;
     }
-    xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
-                              &xshminfo, width, height, dd);
-    if (!xshmpm) {
-        qWarning() << "QNativeImage: Unable to create shared Pixmap.";
+    if (X11->use_mitshm_pixmaps) {
+        xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
+                                  &xshminfo, width, height, dd);
+        if (!xshmpm) {
+            qWarning() << "QNativeImage: Unable to create shared Pixmap.";
+        }
     }
 }