From: Ivailo Monev Date: Thu, 9 Sep 2021 17:47:53 +0000 (+0300) Subject: do not detach source image in write_xpm_image() X-Git-Tag: 4.12.0~1826 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=bc7a9c32acece4ec343ee7d42317409eb55a3bf9;p=kde%2FKatie.git do not detach source image in write_xpm_image() Signed-off-by: Ivailo Monev --- diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 8b5f22056..14ccf9592 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -1032,7 +1032,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const // build color table for(int y = 0; y < h; y++) { - QRgb * yp = (QRgb *)image.scanLine(y); + const QRgb * yp = (const QRgb *)image.constScanLine(y); for(int x = 0; x < w; x++) { QRgb color = *(yp + x); if (!colorMap.contains(color)) @@ -1078,7 +1078,7 @@ static bool write_xpm_image(const QImage &sourceImage, QIODevice *device, const // write pixels, limit to 4 characters per pixel line.truncate(cpp*w); for(int y = 0; y < h; y++) { - QRgb * yp = (QRgb *) image.scanLine(y); + const QRgb * yp = (const QRgb *) image.constScanLine(y); int cc = 0; for(int x = 0; x < w; x++) { int color = (int)(*(yp + x));