src/gui/image/qnativeimage.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   176                             IPC_CREAT | 0777);
   176                             IPC_CREAT | 0777);
   177     ok = xshminfo.shmid != -1;
   177     ok = xshminfo.shmid != -1;
   178     if (ok) {
   178     if (ok) {
   179         xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0);
   179         xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0);
   180         xshminfo.shmaddr = xshmimg->data;
   180         xshminfo.shmaddr = xshmimg->data;
       
   181         if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1)
       
   182             qWarning() << "Error while marking the shared memory segment to be destroyed";
   181         ok = (xshminfo.shmaddr != (char*)-1);
   183         ok = (xshminfo.shmaddr != (char*)-1);
   182         if (ok)
   184         if (ok)
   183             image = QImage((uchar *)xshmimg->data, width, height, systemFormat());
   185             image = QImage((uchar *)xshmimg->data, width, height, systemFormat());
   184     }
   186     }
   185     xshminfo.readOnly = false;
   187     xshminfo.readOnly = false;
   197             shmdt(xshminfo.shmaddr);
   199             shmdt(xshminfo.shmaddr);
   198         if (xshminfo.shmid != -1)
   200         if (xshminfo.shmid != -1)
   199             shmctl(xshminfo.shmid, IPC_RMID, 0);
   201             shmctl(xshminfo.shmid, IPC_RMID, 0);
   200         return;
   202         return;
   201     }
   203     }
   202     xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
   204     if (X11->use_mitshm_pixmaps) {
   203                               &xshminfo, width, height, dd);
   205         xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
   204     if (!xshmpm) {
   206                                   &xshminfo, width, height, dd);
   205         qWarning() << "QNativeImage: Unable to create shared Pixmap.";
   207         if (!xshmpm) {
       
   208             qWarning() << "QNativeImage: Unable to create shared Pixmap.";
       
   209         }
   206     }
   210     }
   207 }
   211 }
   208 
   212 
   209 
   213 
   210 QNativeImage::~QNativeImage()
   214 QNativeImage::~QNativeImage()