I've found a very strange (and serious) miscompilation of QImage with g++
In qimage.cpp there is a simple line (3584 in Qt-5.3.2):
d-paintEngine = paintEngine ? paintEngine : new
QRasterPaintEngine(paintDevice);
which results in 0(!). The return value of this method QImage::paintEngine() is
then 0 -
which should never happen.
I can reproduce with a slightly modified minimal platform plugin, and only if
it has
a second QImage member, which gets its mImage member assigned.
I have created a very small reproducible example program and I verified that
this only
happens when compiling QtGui with gcc (4.8.3 or 4.9.0), but it does not happen
with clang (3.5.0).
All tests are done on x86/64bit Linux (openSuse 13.2) with a self-compiled
Qt5.3.2 (with a namespace, in debug mode).
I also see the problem compiled with gcc-4.8.2 in release mode compiled on a
CentOS-7
Testprogram/diff attached.
Simply run with ./splash -platform minimal and in case of the bug it prints:
created new QImage paint engine 0x0
returning QImage paint engine 0x0
QWidget::paintEngine: Should no longer be called
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setPen: Painter not active
Can anyone please tell me if you can reproduce this ?
Is this really a gcc bug ?
Shall I create a gcc bug report with this example/description or is this much
too large for
a testcase ?
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\- against proprietary attachments
Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at--- qminimalbackingstore.h 2015-02-04 11:00:39.495064795 +0100
+++ new/qminimalbackingstore.h 2015-02-04 11:00:27.635152101 +0100
@@ -59,7 +59,7 @@
void resize(const QSize size, const QRegion staticContents);
private:
-QImage mImage;
+QImage mImage, old;
const bool mDebug;
};
--- qminimalbackingstore.cpp 2015-02-04 11:00:34.051104837 +0100
+++ new/qminimalbackingstore.cpp 2015-02-04 11:00:27.635152101 +0100
@@ -50,11 +50,12 @@
QT_BEGIN_NAMESPACE
QMinimalBackingStore::QMinimalBackingStore(QWindow *window)
-: QPlatformBackingStore(window)
+: QPlatformBackingStore(window), mImage(QSize(100, 100), QGuiApplication::primaryScreen()-handle()-format())
, mDebug(QMinimalIntegration::instance()-options() QMinimalIntegration::DebugBackingStore)
{
if (mDebug)
qDebug() QMinimalBackingStore::QMinimalBackingStore: (quintptr)this;
+old = mImage;
}
QMinimalBackingStore::~QMinimalBackingStore()
--- qimage.cpp 2014-09-23 14:32:27.201254640 +0200
+++ qimage.cpp 2015-02-04 10:50:16.810025578 +0100
@@ -3582,8 +3582,10 @@
if (platformIntegration)
paintEngine = platformIntegration-createImagePaintEngine(paintDevice);
d-paintEngine = paintEngine ? paintEngine : new QRasterPaintEngine(paintDevice);
+qDebug() created new QImage paint engine d-paintEngine;
}
+qDebug() returning QImage paint engine d-paintEngine;
return d-paintEngine;
}
#include QSplashScreen
#include QApplication
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QPixmap pix(100, 100);
QSplashScreen *s = new QSplashScreen(pix);
s-show();
return app.exec();
}
splash.pro
Description: application/vnd.nokia.qt.qmakeprofile
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development