[qt/f15] crash when using a visual with 24 bits per pixel (QTBUG-21754)
Rex Dieter
rdieter at fedoraproject.org
Fri Oct 28 21:17:17 UTC 2011
commit b2c64a8205f1add3a055ddaaca35dc879a7067b5
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Fri Oct 28 16:17:14 2011 -0500
crash when using a visual with 24 bits per pixel (QTBUG-21754)
.gitignore | 3 +-
...erywhere-opensource-src-4.7.4-QTBUG-21754.patch | 117 ++++++++++++++++++++
qt.spec | 13 ++-
3 files changed, 126 insertions(+), 7 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f617247..59dde2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,5 +8,4 @@
/hi48-phonon-gstreamer.png
/hi64-phonon-gstreamer.png
/qt-everywhere-opensource-src-4.7.4.tar.gz
-/qt-everywhere-opensource-src-4.8.0-beta1.tar.gz
-/qt-everywhere-opensource-src-4.8.0-20111002.tar.xz
+/qt-everywhere-opensource-src-4.8.0-rc1.tar.gz
diff --git a/qt-everywhere-opensource-src-4.7.4-QTBUG-21754.patch b/qt-everywhere-opensource-src-4.7.4-QTBUG-21754.patch
new file mode 100644
index 0000000..a908fc8
--- /dev/null
+++ b/qt-everywhere-opensource-src-4.7.4-QTBUG-21754.patch
@@ -0,0 +1,117 @@
+diff -up qt-everywhere-opensource-src-4.7.4/src/gui/image/qnativeimage.cpp.QTBUG-21754 qt-everywhere-opensource-src-4.7.4/src/gui/image/qnativeimage.cpp
+--- qt-everywhere-opensource-src-4.7.4/src/gui/image/qnativeimage.cpp.QTBUG-21754 2011-09-12 01:49:28.000000000 -0500
++++ qt-everywhere-opensource-src-4.7.4/src/gui/image/qnativeimage.cpp 2011-10-28 16:04:53.836638684 -0500
+@@ -150,7 +150,12 @@ QImage::Format QNativeImage::systemForma
+ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
+ : xshmimg(0), xshmpm(0)
+ {
+- if (!X11->use_mitshm) {
++ QX11Info info = widget->x11Info();
++
++ int dd = info.depth();
++ Visual *vis = (Visual*) info.visual();
++
++ if (!X11->use_mitshm || format != QImage::Format_RGB16 && X11->bppForDepth.value(dd) != 32) {
+ image = QImage(width, height, format);
+ // follow good coding practice and set xshminfo attributes, though values not used in this case
+ xshminfo.readOnly = true;
+@@ -160,11 +165,6 @@ QNativeImage::QNativeImage(int width, in
+ return;
+ }
+
+- QX11Info info = widget->x11Info();
+-
+- int dd = info.depth();
+- Visual *vis = (Visual*) info.visual();
+-
+ xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height);
+ if (!xshmimg) {
+ qWarning("QNativeImage: Unable to create shared XImage.");
+diff -up qt-everywhere-opensource-src-4.7.4/src/gui/image/qpixmap_x11.cpp.QTBUG-21754 qt-everywhere-opensource-src-4.7.4/src/gui/image/qpixmap_x11.cpp
+--- qt-everywhere-opensource-src-4.7.4/src/gui/image/qpixmap_x11.cpp.QTBUG-21754 2011-09-12 01:49:28.000000000 -0500
++++ qt-everywhere-opensource-src-4.7.4/src/gui/image/qpixmap_x11.cpp 2011-10-28 16:04:53.837638713 -0500
+@@ -897,12 +897,20 @@ void QX11PixmapData::fromImage(const QIm
+ }
+ )
+ break;
+- case BPP24_888: // 24 bit MSB
++ case BPP24_888:
+ CYCLE(
+- for (int x=0; x<w; x++) {
+- *dst++ = qRed (*p);
+- *dst++ = qGreen(*p);
+- *dst++ = qBlue (*p++);
++ if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
++ for (int x=0; x<w; x++) {
++ *dst++ = qRed (*p);
++ *dst++ = qGreen(*p);
++ *dst++ = qBlue (*p++);
++ }
++ } else {
++ for (int x=0; x<w; x++) {
++ *dst++ = qBlue (*p);
++ *dst++ = qGreen(*p);
++ *dst++ = qRed (*p++);
++ }
+ }
+ )
+ break;
+diff -up qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qapplication_x11.cpp.QTBUG-21754 qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qapplication_x11.cpp
+--- qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qapplication_x11.cpp.QTBUG-21754 2011-09-12 01:49:28.000000000 -0500
++++ qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qapplication_x11.cpp 2011-10-28 16:04:53.838638742 -0500
+@@ -1892,6 +1892,12 @@ void qt_init(QApplicationPrivate *priv,
+ X11->defaultScreen = DefaultScreen(X11->display);
+ X11->screenCount = ScreenCount(X11->display);
+
++ int formatCount = 0;
++ XPixmapFormatValues *values = XListPixmapFormats(X11->display, &formatCount);
++ for (int i = 0; i < formatCount; ++i)
++ X11->bppForDepth[values[i].depth] = values[i].bits_per_pixel;
++ XFree(values);
++
+ X11->screens = new QX11InfoData[X11->screenCount];
+ X11->argbVisuals = new Visual *[X11->screenCount];
+ X11->argbColormaps = new Colormap[X11->screenCount];
+diff -up qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qt_x11_p.h.QTBUG-21754 qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qt_x11_p.h
+--- qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qt_x11_p.h.QTBUG-21754 2011-09-12 01:49:28.000000000 -0500
++++ qt-everywhere-opensource-src-4.7.4/src/gui/kernel/qt_x11_p.h 2011-10-28 16:04:53.839638771 -0500
+@@ -54,6 +54,7 @@
+ //
+
+ #include "QtGui/qwindowdefs.h"
++#include "QtCore/qhash.h"
+ #include "QtCore/qlist.h"
+ #include "QtCore/qvariant.h"
+
+@@ -467,6 +468,7 @@ struct QX11Data
+ Colormap *argbColormaps;
+ int screenCount;
+ int defaultScreen;
++ QHash<int, int> bppForDepth;
+
+ Time time;
+ Time userTime;
+diff -up qt-everywhere-opensource-src-4.7.4/src/gui/painting/qwindowsurface_raster.cpp.QTBUG-21754 qt-everywhere-opensource-src-4.7.4/src/gui/painting/qwindowsurface_raster.cpp
+--- qt-everywhere-opensource-src-4.7.4/src/gui/painting/qwindowsurface_raster.cpp.QTBUG-21754 2011-09-12 01:49:28.000000000 -0500
++++ qt-everywhere-opensource-src-4.7.4/src/gui/painting/qwindowsurface_raster.cpp 2011-10-28 16:11:47.145681289 -0500
+@@ -224,9 +224,10 @@ void QRasterWindowSurface::flush(QWidget
+ } else
+ #endif
+ {
++ int depth = widget->x11Info().depth();
+ const QImage &src = d->image->image;
+ br = br.intersected(src.rect());
+- if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
++ if (src.format() != QImage::Format_RGB32 || depth < 24 || X11->bppForDepth.value(depth) != 32) {
+ Q_ASSERT(src.depth() >= 16);
+ const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8),
+ br.width(), br.height(), src.bytesPerLine(), src.format());
+@@ -238,7 +239,7 @@ void QRasterWindowSurface::flush(QWidget
+ } else {
+ // qpaintengine_x11.cpp
+ extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
+- qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
++ qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth);
+ }
+ }
+
diff --git a/qt.spec b/qt.spec
index 488118d..d1ac44d 100644
--- a/qt.spec
+++ b/qt.spec
@@ -18,7 +18,7 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.7.4
-Release: 4%{?dist}
+Release: 5%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
@@ -82,9 +82,6 @@ Patch60: qt-4.6.3-bn-rendering-bz562058.patch
Patch61: qt-4.6.3-indic-rendering-bz631732.patch
Patch62: qt-4.6.3-indic-rendering-bz636399.patch
-# fix 24bit color issue
-Patch63: qt-everywhere-opensource-src-4.7.0-bpp24.patch
-
# Fails to create debug build of Qt projects on mingw (rhbz#653674)
Patch64: qt-everywhere-opensource-src-4.7.1-QTBUG-14467.patch
@@ -92,6 +89,9 @@ Patch64: qt-everywhere-opensource-src-4.7.1-QTBUG-14467.patch
Patch70: qt-everywhere-opensource-src-4.8.0-QTBUG-14724.patch
# upstream patches
+# Applications crash when using a visual with 24 bits per pixel
+# https://bugreports.qt.nokia.com/browse/QTBUG-21754
+Patch100: qt-everywhere-opensource-src-4.7.4-QTBUG-21754.patch
# adds debug support to webkit/JavaScriptCore
# UPSTREAM ME
Patch105: qt-everywhere-opensource-src-4.7.1-webkit_debug_javascriptcore.patch
@@ -529,11 +529,11 @@ Qt libraries used for drawing widgets and OpenGL items.
%patch60 -p1 -b .bn-rendering-bz562058
%patch61 -p1 -b .indic-rendering-bz631732
%patch62 -p1 -b .indic-rendering-bz636399
-%patch63 -p1 -b .bpp24
%patch64 -p1 -b .QTBUG-14467
%patch70 -p1 -b .QTBUG-14724
## upstream patches
+%patch100 -p1 -b .QTBUG-21754
%patch105 -p1 -b .webkit_debug_javascriptcore
%patch107 -p1 -b .QTBUG-19947-fontconfig-2
# Merged in 4.8.
@@ -1294,6 +1294,9 @@ fi
%changelog
+* Fri Oct 28 2011 Rex Dieter <rdieter at fedoraproject.org> 1:4.7.4-5
+- crash when using a visual with 24 bits per pixel (QTBUG-21754)
+
* Mon Oct 17 2011 Rex Dieter <rdieter at fedoraproject.org> 1:4.7.4-4
- Qt doesn't close orphaned file descriptors after printing (#746601, QTBUG-14724)
- -webkit: Provides: qtwebkit(-devel)
More information about the scm-commits
mailing list