[PyKDE] QPixmap problem under Windows?

Andrew Bushnell awb at fluent.com
Fri Jul 22 15:42:59 BST 2005



Erik Åldstedt Sund wrote:

> Hi,
> 
> We've got a problem which we hope some of you have at least seen
> before, or maybe even know how to solve... When we run our unittest
> suite under Windows we get the following warning/error messages from
> Qt:
> 
> 	ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 	...ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 
> Somewhere else in our tests it may print something like:
> 
> 	...ASSERT: "hBitmap" in kernel\qpixmap_win.cpp (117)
> 	ASSERT: "data->realAlphaBits" in kernel\qpixmap_win.cpp (118)
> 
> and segfault. If we set up our test system to ignore the test that
> segfaults it gets a little longer, but now the screen gets all messed
> up and the computer hangs! Before it hangs it displays something like
> the following two outputs:
> 
> 	.QPixmap::setMask: The pixmap and the mask must have the same size
> 	ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 	QPainter::begin: Cannot paint null pixmap
> 	ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 	QPainter::end: Missing begin() or begin() failed
> 	QPixmap::setMask: The pixmap and the mask must have the same size
> 	.QPixmap::setMask: The pixmap and the mask must have the same size
> 	ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 	QPainter::begin: Cannot paint null pixmap
> 
> 	.QPainter::begin: Cannot paint null pixmap
> 	QPainter::begin: Cannot paint null pixmap
> 	QPainter::end: Missing begin() or begin() failed
> 	QPainter::begin: Cannot paint null pixmap
> 	ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
> 	QPainter::end: Missing begin() or begin() failed
> 	QImage::convertDepth: Image is a null image
> 	QPixmap::convertFromImage: Cannot convert a null image
> 	QCursor: Cannot create bitmap cursor; invalid bitmap(s)
> 
> This output is very strange as we've never seen anything like this
> under Linux. Also the application itself seems to run very fine under
> both platforms. To complicate things further:
>  * running each test-case one-by-one does not crash the computer
>    (though some of the warning/error messages from Qt still appears on
>    the screen).
>  * running one-by-one test in each testcase, we see no warning/error
>    messages from Qt at all.
> 
> If someone has seen anything like this before, or knows how to solve
> this problem, we would be very grateful!
> 
> 
> [ Some background: ]
> 
> We are developing a cross-platform application using Python 2.3 and
> PyQt 3.14.1 with Qt 3.3.4.
> 
> We have written testcases that tests correct behaviour in
> GUI-elements. When doing so we need to create a QApplication instance
> before each test is run. This QApplication instance is then deleted
> after the test is run in the following manner:
> 
> 	QTimer.singleShot(0, self.qapplication.quit)
> 	self.qapplication.exec_loop()
> 	del self.qapplication
> 
> thus starting the GUI-thread, and quitting it first thing when it has
> started, before deleting it.
> 
> 
> Greetings,
> Erik.
> 
Erik,

It appears that you possibly are running out of resource handles or 
something on your windows system. If you have not done so already, you 
may want to look at using a cache for your QPixMaps and reuse object, 
rather than create one each time. We had similar problems and when 
turning to a caching mechanism, our problems disappeared. You should 
also verify that the objects are getting cleaned up properly.

Anyway, if it helps.


-- 
************************************
Andrew Bushnell
Lead Development Engineer
Fluent Inc.
10 Cavendish Court
Centerra Resource Park
Lebanon, NH  03766
awb at fluent.com
Phone: 603-643-2600, ext. 757
Fax: 603-643-1721
www.fluent.com
************************************




More information about the PyQt mailing list