QOpenGLDebugLogger: do not crash if deleted with the wrong GL context current

Task-number: QTBUG-54799
Change-Id: Ifee3183e7944fbe266fe644628d33d0667be99a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2016-07-19 13:48:33 +01:00
parent d9831a03ca
commit 107ac187bc

View File

@ -1500,6 +1500,12 @@ void QOpenGLDebugLogger::stopLogging()
if (!d->isLogging)
return;
QOpenGLContext *currentContext = QOpenGLContext::currentContext();
if (!currentContext || currentContext != d->context) {
qWarning("QOpenGLDebugLogger::stopLogging(): attempting to stop logging with the wrong OpenGL context current");
return;
}
d->isLogging = false;
d->glDebugMessageCallback(d->oldDebugCallbackFunction, d->oldDebugCallbackParameter);