[digikam] digikam crashes with "-graphicssystem raster" (#726971)
Rex Dieter
rdieter at fedoraproject.org
Thu Aug 18 17:40:06 UTC 2011
commit aa17a78a3ebcf17ec9c2c55e96510a8eab98ec6a
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Thu Aug 18 12:39:55 2011 -0500
digikam crashes with "-graphicssystem raster" (#726971)
digikam-2.0.0-qt_rasterengine.patch | 93 +++++++++++++++++++++++++++++++++++
digikam.spec | 10 +++-
2 files changed, 102 insertions(+), 1 deletions(-)
---
diff --git a/digikam-2.0.0-qt_rasterengine.patch b/digikam-2.0.0-qt_rasterengine.patch
new file mode 100644
index 0000000..89d37d3
--- /dev/null
+++ b/digikam-2.0.0-qt_rasterengine.patch
@@ -0,0 +1,93 @@
+commit 2b739c70f008ac2538eb635b7334104167ad0a50
+Author: Marcel Wiesweg <marcel.wiesweg at gmx.de>
+Date: Sat Aug 6 16:51:41 2011 +0200
+
+ Pass a persistent QImage to QPixmap::fromImage when paint engine is raster.
+ For native engines, a temporary QImage can be provided, but raster will just take
+ and store the QImage, so a memcpy is needed.
+ The paint engine relevant for pixmaps can be detected by opening a painter on a
+ 1x1 pixmap and querying the QPaintEngine. For optimization, this is done only once
+ per application lifetime because DImg::convertToPixmap is very time critical.
+
+ BUG: 278320
+
+--- a/libs/dimg/dimg.cpp
++++ b/libs/dimg/dimg.cpp
+@@ -47,6 +47,8 @@ extern "C"
+ #include <QFile>
+ #include <QFileInfo>
+ #include <QMap>
++#include <QPaintEngine>
++#include <QPainter>
+ #include <QPixmap>
+ #include <QSysInfo>
+ #include <QDebug>
+@@ -55,6 +57,7 @@ extern "C"
+ // KDE includes
+
+ #include <kdebug.h>
++#include <kglobal.h>
+
+ // LibKDcraw includes
+
+@@ -1768,6 +1771,34 @@ QImage DImg::copyQImage(int x, int y, int w, int h) const
+ return img.copyQImage();
+ }
+
++class PixmapPaintEngineDetector
++{
++public:
++
++ PixmapPaintEngineDetector()
++ : m_isRaster(detectRasterFromPixmap())
++ {
++ }
++
++ bool isRaster() const
++ {
++ return m_isRaster;
++ }
++
++private:
++
++ static bool detectRasterFromPixmap()
++ {
++ QPixmap pix(1,1);
++ QPainter p(&pix);
++ return p.paintEngine() && p.paintEngine()->type() == QPaintEngine::Raster;
++ }
++
++ const bool m_isRaster;
++};
++
++K_GLOBAL_STATIC(PixmapPaintEngineDetector, pixmapPaintEngineDetector)
++
+ QPixmap DImg::convertToPixmap() const
+ {
+ if (isNull())
+@@ -1796,18 +1827,21 @@ QPixmap DImg::convertToPixmap() const
+ sptr += 4;
+ }
+
+- // NOTE: Qt4 do not provide anymore QImage::setAlphaChannel() because
+ // alpha channel is auto-detected during QImage->QPixmap conversion
+-
+ return QPixmap::fromImage(img);
+ }
+ else
+ {
++ // This is a temporary image operating on the DImg buffer
+ QImage img(bits(), width(), height(), hasAlpha() ? QImage::Format_ARGB32 : QImage::Format_RGB32);
+
+- // NOTE: Qt4 do not provide anymore QImage::setAlphaChannel() because
+- // alpha channel is auto-detected during QImage->QPixmap conversion
++ // For paint engines which base the QPixmap internally on a QImage, we must use a persistent QImage
++ if (pixmapPaintEngineDetector->isRaster())
++ {
++ img = img.copy();
++ }
+
++ // alpha channel is auto-detected during QImage->QPixmap conversion
+ return QPixmap::fromImage(img);
+ }
+ }
diff --git a/digikam.spec b/digikam.spec
index ce2a91d..11e6a75 100644
--- a/digikam.spec
+++ b/digikam.spec
@@ -1,7 +1,7 @@
Name: digikam
Version: 2.0.0
-Release: 2%{?pre}%{?dist}
+Release: 3%{?pre}%{?dist}
Summary: A digital camera accessing & photo management application
License: GPLv2+
@@ -16,6 +16,7 @@ Source1: digikam-import.desktop
## upstreamable patches
## upstream patches
+Patch100: digikam-2.0.0-qt_rasterengine.patch
BuildRequires: desktop-file-utils
BuildRequires: doxygen
@@ -181,6 +182,10 @@ Requires: kipi-plugins = %{version}-%{release}
%prep
%setup -q -n %{name}-%{version}%{?pre:-%{pre}}
+pushd core
+%patch100 -p1 -b .qt_rasterengine
+popd
+
%build
@@ -423,6 +428,9 @@ update-desktop-database -q &> /dev/null
%changelog
+* Thu Aug 18 2011 Rex Dieter <rdieter at fedoraproject.org> 2.0.0-3
+- digikam crashes with "-graphicssystem raster" (#726971)
+
* Tue Aug 02 2011 Rex Dieter <rdieter at fedoraproject.org> 2.0.0-2
- new libkface, libkgeomap, libmediawiki subpkgs (#727570)
- remove rpm cruft (%%clean, %%defattr, Group:, BuildRoot:)
More information about the scm-commits
mailing list