[Interest] Crash inside QOpenGLDebugLogger with Qt 5.2 / VS2012
Roger Leigh
rleigh at codelibre.net
Sun Apr 13 18:26:17 CEST 2014
On Sun, Apr 13, 2014 at 05:22:21PM +0200, Giuseppe D'Angelo wrote:
> Hello,
>
> Il 13/04/2014 15:05, Roger Leigh ha scritto:
> >QWindowsGLContext::getProcAddress: Unable to resolve 'glGetPointerv'
>
> This has already been reported and I've already fixed it in
>
> > https://codereview.qt-project.org/#change,78981
Super, thanks. Just as a suggestion, there's still a failure
path which can cause a crash here. This fixes it:
commit 93edfda47f043172cf26baf14e40c57c0734341d
Author: Roger Leigh <rleigh at codelibre.net>
Date: Sun Apr 13 14:59:25 2014 +0100
QOpenGLDebugLogger: Fail initialisation if any GL functions are null
QOpenGLDebugLogger::initialize() contains a GET_DEBUG_PROC_ADDRESS
macro to obtain OpenGL function pointers. However, it does not
fail safely if a function pointer is null. This can lead to program
crashes when the pointers get used, for example glGetPointerv will
cause a crash in QOpenGLDebugLogger::startLogging() if it is null.
Remove the potential for a null OpenGL function pointer dereference in
QOpenGLDebugLogger.
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 90d062f..6b9b556 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -1356,7 +1356,9 @@ bool QOpenGLDebugLogger::initialize()
#define GET_DEBUG_PROC_ADDRESS(procName) \
d->procName = reinterpret_cast< qt_ ## procName ## _t >( \
d->context->getProcAddress(QByteArrayLiteral( #procName )) \
- );
+ ); \
+ if (!d->procName) \
+ return false;
GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);
GET_DEBUG_PROC_ADDRESS(glDebugMessageInsert);
Your special case of glGetPointerv would also need the return false
adding on failure.
I know under normal circumstances all the functions should
resolve. But if they don't, this ensures they won't be used
because we don't complete init and mark the logger as
initialised.
> which is going to appear in 5.3. Out of curiosity, which combination
> of GPU / drivers are you using?
I'm using an AMD Radeon HD 6850 with Catalyst
2013.1206.1603.28764 (latest stable) on Windows 7 x64 and
the same with fglrx for Linux amd64.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' schroot and sbuild http://alioth.debian.org/projects/buildd-tools
`- GPG Public Key F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
More information about the Interest
mailing list