Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.12.2
-
None
-
The application is 32bit developing with Qt 5.12.2 and VS2107;
-
-
11209cfde (dev), 64c8cc93d (6.5), 67f78a1e7 (tqtc/lts-6.2)
Description
I have a program which call QOpenGLWidget::grabFramebuffer 15 times per second. Then I found it is qt_gl_read_framebuffer_rgba8 that cause a crash which show info "nvoglv32!DrvPresentBuffers+0xf71ab" at the top of stack nvoglv32.dll. In qt_gl_read_framebuffer_rgba8, it malloc a local QImage so that passing it to funcs->glReadPixels(), however, the d pointer of QImage is usually 0x00000000. The reaon may be it is too frequently that I call grabFramebuffer(), the memory can not find enough space for QImage whose size is is 1280*720*4 Bytes (the same as QImage out of memory).
If the QImage's d pointer is 0x00000000 in qt_gl_read_framebuffer_rgba8, the glReadPixels must crash at nvoglv32.dll with info "nvoglv32!DrvPresentBuffers+0xf71ab".
So, why not we add a condition for determining whether QImage is NULL? After all, it is inevitable for objects like QImage that occupy consecutive large blocks of memory to fail their application. For example:
// code placeholder QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); if (img.isNull()) return QImage(); // ADD THIS CONDITION funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, img.bits()); return img;
If so, the user can determine whether img is available, rather than a memory out crash.
Attachments
Issue Links
- is duplicated by
-
QTBUG-107491 QWebEngineView->render() throws nullptr exception
- Closed