[gtk/wip/baedert/for-master: 171/180] filechooserwidget: gtk_widget_get_root() can return NULL




commit b76ec78a39d3195d3265bc1d0b64bbc8b5d5f43c
Author: Timm Bäder <mail baedert org>
Date:   Thu Oct 15 06:56:58 2020 +0200

    filechooserwidget: gtk_widget_get_root() can return NULL

 gtk/gtkfilechooserwidget.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 50b9f6033e..171301a24b 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -619,11 +619,11 @@ gtk_file_chooser_widget_finalize (GObject *object)
 static GtkWindow *
 get_toplevel (GtkWidget *widget)
 {
-  GtkWidget *toplevel;
+  GtkRoot *root;
 
-  toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
-  if (GTK_IS_WINDOW (toplevel))
-    return GTK_WINDOW (toplevel);
+  root = gtk_widget_get_root (widget);
+  if (root && GTK_IS_WINDOW (root))
+    return GTK_WINDOW (root);
   else
     return NULL;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]