]> git.sesse.net Git - kdenlive/commitdiff
Fix crashes in the color picker on X11
authorTill Theato <root@ttill.de>
Wed, 11 Aug 2010 11:41:14 +0000 (11:41 +0000)
committerTill Theato <root@ttill.de>
Wed, 11 Aug 2010 11:41:14 +0000 (11:41 +0000)
svn path=/trunk/kdenlive/; revision=4703

src/colorpickerwidget.cpp

index 9a4eb3aaf815e64a823a696a8a09ddb87401b180..acd1d26982a8be5378c146f2395f5582abaa6b66 100644 (file)
@@ -59,6 +59,7 @@ ColorPickerWidget::ColorPickerWidget(QWidget *parent) :
 {
 #ifdef Q_WS_X11
     m_filter = 0;
+    m_image = NULL;
 #endif
 
     QHBoxLayout *layout = new QHBoxLayout(this);
@@ -140,6 +141,7 @@ QColor ColorPickerWidget::averagePickedColor(const QPoint pos)
 
 #ifdef Q_WS_X11
     XDestroyImage(m_image);
+    m_image = NULL;
 #endif
 
     if (size > 200)
@@ -222,7 +224,7 @@ QColor ColorPickerWidget::grabColor(const QPoint &p, bool destroyImage)
     if( !qApp->desktop()->geometry().contains( p ))
         return QColor();
     unsigned long xpixel;
-    if (m_image == 0) {
+    if (m_image == NULL) {
         Window root = RootWindow(QX11Info::display(), QX11Info::appScreen());
         m_image = XGetImage(QX11Info::display(), root, p.x(), p.y(), 1, 1, -1, ZPixmap);
         xpixel = XGetPixel(m_image, 0, 0);