PDA

View Full Version : ASSERT: "bitmap" in file image\qnativeimage.cpp, line 114



DusanDusan
22nd May 2012, 18:38
Hi all, I am facing to assertion failed issue in image\qnativeimage.cpp at line 114.

I use open source QT version 4.7.1 and QTWinMigrate 2.8_1 in standalone MFC application where I can not modify code, so I use QMfcApp.pluginInstance to attach.
I have looked into call stack and it seems like low memory issue, but I think it is not.

Problem seems to be that QNativeImage is asked to allocate bitmap of size 32768 * 32768 which is probably too much (you can see it in fallowing call stack).
Does anybody know how to avoid this issue? Or at least how can I workaround it?

Follows my call stack:
QtCored4.dll!qt_message_output(QtMsgType msgType=QtFatalMsg, const char * buf=0x10b705a8) Line 2270 C++
QtCored4.dll!qt_message(QtMsgType msgType=QtFatalMsg, const char * msg=0x672a6a80, char * ap=0x0027e764) Line 2328 + 0x12 bytes C++
QtCored4.dll!qFatal(const char * msg=0x672a6a80, ...) Line 2511 + 0xf bytes C++
QtCored4.dll!qt_assert(const char * assertion=0x11ff0314, const char * file=0x11ff02fc, int line=114) Line 2027 + 0x16 bytes C++
QtGuid4.dll!QNativeImage::QNativeImage(int width=32767, int height=32767, QImage::Format format=Format_RGB32, bool isTextBuffer=false, QWidget * __formal=0x10bc0ce0) Line 114 + 0x1b bytes C++
QtGuid4.dll!QRasterWindowSurface::prepareBuffer(QI mage::Format format=Format_RGB32, QWidget * widget=0x10bc0ce0) Line 378 + 0x34 bytes C++
> QtGuid4.dll!QRasterWindowSurface::setGeometry(cons t QRect & rect={...}) Line 325 C++
QtGuid4.dll!QWidgetBackingStore::sync() Line 1183 C++
QtGuid4.dll!QWidgetPrivate::syncBackingStore() Line 1819 C++
QtGuid4.dll!QWidget::event(QEvent * event=0x10b1a720) Line 8494 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QOb ject * receiver=0x10bc0ce0, QEvent * e=0x10b1a720) Line 4445 + 0x11 bytes C++
QtGuid4.dll!QApplication::notify(QObject * receiver=0x10bc0ce0, QEvent * e=0x10b1a720) Line 4410 + 0x10 bytes C++
QtCored4.dll!QCoreApplication::notifyInternal(QObj ect * receiver=0x10bc0ce0, QEvent * event=0x10b1a720) Line 732 + 0x15 bytes C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver=0x10bc0ce0, QEvent * event=0x10b1a720) Line 215 + 0x39 bytes C++
QtCored4.dll!QCoreApplicationPrivate::sendPostedEv ents(QObject * receiver=0x00000000, int event_type=0, QThreadData * data=0x0df77258) Line 1373 + 0xd bytes C++
QtCored4.dll!QCoreApplication::sendPostedEvents(QO bject * receiver=0x00000000, int event_type=-1) Line 1266 + 0x11 bytes C++
QtWinMigrate-2.8d.dll!QtFilterProc(int nCode=0, unsigned int wParam=1, long lParam=2618184) Line 105 + 0x10 bytes C++

Thanks in advance,
Dusan

ChrisW67
22nd May 2012, 23:43
That assertion seems to be because Windows is not returning a valid device context from a call to CreateCompatibleDC(). Since nothing in the stack back trace relates to your code we have no way of knowing what triggered this situation.

DusanDusan
23rd May 2012, 06:30
Hi, thanks for reply.

DC returned seems to be correct (hdc is not NULL), but CreateDIBSection returns NULL, so Q_ASSERT(bitmap) invokes this.

My QDialog is right before this assertion hidden by its non QT parent set using Win32 API function SetParent. I can not influence the way how is my widget attached. All I had to do is return HWND of my window.

QT is open source, may I try to repair this issue? I found that some more people on internet had the same issue without solutions.

What is the source of values width=32767 height=32767? For me those seems to be Maximum size, but it is too much to allocate so it fails.

Dusan