diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2014-10-16 17:40:23 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-27 15:19:22 +0100 |
commit | cd996c1b85313e89e781f5bd02e5aeae98b69d73 (patch) | |
tree | 4ceed7ac35a8e3b3f17bc80d27628b642854f6a3 | |
parent | 2b666d9576210aa98700e219dba6b1bd4f93d793 (diff) |
QGtkStyle: fix segfault after re-creating QApp
QGtkStylePrivate::setupGtkWidget() cannot use a local static variable
for the container, but it must insert it to the GTK widget map together
with all other GTK widgets. The container is destructed as a GtkWindow
child in the Qt post routine QGtkStylePrivate::destroyWidgetMap().
Task-number: QTBUG-41145
Change-Id: If1fda372ed1227edc779fa4951cbd6fbf6038499
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Jens Bache-Wiig <jensbw@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
-rw-r--r-- | src/widgets/styles/qgtkstyle_p.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 06ee74bdfe..61d1cd796e 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -701,10 +701,12 @@ GtkWidget* QGtkStylePrivate::getTextColorWidget() const void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget) { if (Q_GTK_IS_WIDGET(widget)) { - static GtkWidget* protoLayout = 0; + GtkWidget *protoLayout = gtkWidgetMap()->value("GtkContainer"); if (!protoLayout) { protoLayout = QGtkStylePrivate::gtk_fixed_new(); QGtkStylePrivate::gtk_container_add((GtkContainer*)(gtkWidgetMap()->value("GtkWindow")), protoLayout); + QHashableLatin1Literal widgetPath = QHashableLatin1Literal::fromData(strdup("GtkContainer")); + gtkWidgetMap()->insert(widgetPath, protoLayout); } Q_ASSERT(protoLayout); |