From d5059601e64882a848f6e6730690c270c7b120c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Mon, 19 May 2014 19:06:53 +0200 Subject: [PATCH] Fix overwriting memory for an application icon This resolves Bug 2033 --- src/kernel/qimage.cpp | 12 ++++++------ src/kernel/qpixmap_x11.cpp | 4 +++- src/kernel/qwidget_x11.cpp | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kernel/qimage.cpp b/src/kernel/qimage.cpp index 059b5baf..a22b744a 100644 --- a/src/kernel/qimage.cpp +++ b/src/kernel/qimage.cpp @@ -1531,12 +1531,12 @@ static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_fl int* line2[3]; int* pv[3]; if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::DiffuseDither ) { - line1[0] = new int[src->width()]; - line2[0] = new int[src->width()]; - line1[1] = new int[src->width()]; - line2[1] = new int[src->width()]; - line1[2] = new int[src->width()]; - line2[2] = new int[src->width()]; + line1[0] = new int[sw]; + line2[0] = new int[sw]; + line1[1] = new int[sw]; + line2[1] = new int[sw]; + line1[2] = new int[sw]; + line2[2] = new int[sw]; pv[0] = new int[sw]; pv[1] = new int[sw]; pv[2] = new int[sw]; diff --git a/src/kernel/qpixmap_x11.cpp b/src/kernel/qpixmap_x11.cpp index cc9c211c..00564b33 100644 --- a/src/kernel/qpixmap_x11.cpp +++ b/src/kernel/qpixmap_x11.cpp @@ -764,6 +764,7 @@ TQImage TQPixmap::convertToImage() const else #endif qSafeXDestroyImage( xi ); + ((TQPixmap*)this)->data->ximage = 0; return image; } @@ -947,7 +948,8 @@ TQImage TQPixmap::convertToImage() const qt_XShmDestroyImage( xi, &shminfo ); else #endif - qSafeXDestroyImage( xi ); + qSafeXDestroyImage( xi ); + ((TQPixmap*)this)->data->ximage = 0; return image; } diff --git a/src/kernel/qwidget_x11.cpp b/src/kernel/qwidget_x11.cpp index 8e9cc3ab..8e0fee27 100644 --- a/src/kernel/qwidget_x11.cpp +++ b/src/kernel/qwidget_x11.cpp @@ -1336,7 +1336,6 @@ void TQWidget::setIcon( const TQPixmap &pixmap ) int r = int( tqRed( l ) ); int g = int( tqGreen( l ) ); int b = int( tqBlue( l ) ); - ls[x] = tqRgb( r, g, b ); XSetForeground(x11Display(), gc, (r << 16) | (g << 8) | b ); XDrawPoint(x11Display(), pmHandle, gc, x, y); }