Only cleanup share widget if it has been created.
Without this change a not yet created share widget is created once qt_destroy_gl_share_widget() is called. As creating the widget also triggers a call to qt_cleanup_gl_share_widget() once QApplication is destroyed a QApplication created afterwards cannot use a share widget anymore. This functionality is needed for Harmattan. Merge-request: 2609 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> (cherry picked from commit 8680d831fb7066feae07690a4a6bc8e908a84e5a)
This commit is contained in:
parent
f1e0993419
commit
0b2f70a5de
@ -184,7 +184,9 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
|
||||
class QGLGlobalShareWidget
|
||||
{
|
||||
public:
|
||||
QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {}
|
||||
QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {
|
||||
created = true;
|
||||
}
|
||||
|
||||
QGLWidget *shareWidget() {
|
||||
if (!initializing && !widget && !cleanedUp) {
|
||||
@ -223,6 +225,7 @@ public:
|
||||
}
|
||||
|
||||
static bool cleanedUp;
|
||||
static bool created;
|
||||
|
||||
QGLPixmapData *firstPixmap;
|
||||
int widgetRefCount;
|
||||
@ -233,6 +236,7 @@ private:
|
||||
};
|
||||
|
||||
bool QGLGlobalShareWidget::cleanedUp = false;
|
||||
bool QGLGlobalShareWidget::created = false;
|
||||
|
||||
static void qt_cleanup_gl_share_widget();
|
||||
Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget,
|
||||
@ -242,7 +246,8 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget,
|
||||
|
||||
static void qt_cleanup_gl_share_widget()
|
||||
{
|
||||
_qt_gl_share_widget()->cleanup();
|
||||
if (QGLGlobalShareWidget::created)
|
||||
_qt_gl_share_widget()->cleanup();
|
||||
}
|
||||
|
||||
QGLWidget* qt_gl_share_widget()
|
||||
@ -254,7 +259,8 @@ QGLWidget* qt_gl_share_widget()
|
||||
|
||||
void qt_destroy_gl_share_widget()
|
||||
{
|
||||
_qt_gl_share_widget()->destroy();
|
||||
if (QGLGlobalShareWidget::created)
|
||||
_qt_gl_share_widget()->destroy();
|
||||
}
|
||||
|
||||
const QGLContext *qt_gl_share_context()
|
||||
|
Loading…
Reference in New Issue
Block a user