QOpenGLTexturePrivate::destroy(): Make error messages more verbose

Distinguish missing and non-sharing contexts, output values.

Change-Id: If52555098c1b46e6016e00f9dbbfad8e4b5d3a2d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Friedemann Kleint 2017-05-11 13:49:01 +02:00
parent 9eb00a3397
commit 6a8a93a2a1

View File

@ -190,11 +190,20 @@ void QOpenGLTexturePrivate::destroy()
return; return;
} }
QOpenGLContext *currentContext = QOpenGLContext::currentContext(); QOpenGLContext *currentContext = QOpenGLContext::currentContext();
if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) { if (!currentContext) {
qWarning("Texture is not valid in the current context.\n" qWarning("QOpenGLTexturePrivate::destroy() called without a current context.\n"
"Texture has not been destroyed"); "Texture has not been destroyed");
return; return;
} }
if (!QOpenGLContext::areSharing(currentContext, context)) {
qWarning("QOpenGLTexturePrivate::destroy() called but texture context %p"
" is not shared with current context %p.\n"
"Texture has not been destroyed",
static_cast<const void *>(context),
static_cast<const void *>(currentContext));
return;
}
functions->glDeleteTextures(1, &textureId); functions->glDeleteTextures(1, &textureId);