From: Jinhyung Jo Date: Mon, 12 Dec 2016 11:56:04 +0000 (+0900) Subject: display: fix null pointer dereference with tablet X-Git-Tag: TizenStudio_2.0_p2.4~11^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe7a4ce00847da9a6371761fc8170974765c6900;p=sdk%2Femulator%2Fqemu.git display: fix null pointer dereference with tablet Check whether the touchscreen device is accessible. Change-Id: I85956f7b13ac534c738797843bc411d128eebc08 Signed-off-by: Jinhyung Jo --- diff --git a/tizen/src/ui/displayglwidget.cpp b/tizen/src/ui/displayglwidget.cpp index 14aa91b..e49e516 100644 --- a/tizen/src/ui/displayglwidget.cpp +++ b/tizen/src/ui/displayglwidget.cpp @@ -402,22 +402,26 @@ void DisplayGLWidget::initializeGL() mTexCoords[10] = 0; mTexCoords[11] = 1; - GLuint curTexture = 0; - mFuncs->glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&curTexture); - const QImage img = getTouchScreenHelper()->getMtTracker()->getPointImage(); - mFuncs->glGenTextures(1, &mtTexture); - mFuncs->glBindTexture(GL_TEXTURE_2D, mtTexture); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - mFuncs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_BGRA, - GL_UNSIGNED_INT_8_8_8_8_REV, - (const void *)img.constBits()); - mFuncs->glBindTexture(GL_TEXTURE_2D, curTexture); + if (isTsEnabled) { + GLuint curTexture = 0; + mFuncs->glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&curTexture); + const QImage img = getTouchScreenHelper()->getMtTracker()->getPointImage(); + mFuncs->glGenTextures(1, &mtTexture); + mFuncs->glBindTexture(GL_TEXTURE_2D, mtTexture); + mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + mFuncs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, + (const void *)img.constBits()); + mFuncs->glBindTexture(GL_TEXTURE_2D, curTexture); + } if (!maskQImage.isNull()) { + GLuint curTexture = 0; + mFuncs->glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&curTexture); mFuncs->glGenTextures(1, &maskTexture); mFuncs->glBindTexture(GL_TEXTURE_2D, maskTexture); mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);