[gtk/bilelmoussaoui/layout-manager] layout manager: add a check if the widget exists




commit 6c02017212a40af325c6e19019b4a7491d913618
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Fri Feb 11 11:44:16 2022 +0100

    layout manager: add a check if the widget exists
    
    Avoid a crash when calling _gtk_widget_get_first_child
    Fixes https://github.com/gtk-rs/gtk4-rs/issues/889

 gtk/gtklayoutmanager.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gtk/gtklayoutmanager.c b/gtk/gtklayoutmanager.c
index 57746fd03e..6467b8ee5a 100644
--- a/gtk/gtklayoutmanager.c
+++ b/gtk/gtklayoutmanager.c
@@ -424,6 +424,7 @@ gtk_layout_manager_get_request_mode (GtkLayoutManager *manager)
   GtkLayoutManagerClass *klass;
 
   g_return_val_if_fail (GTK_IS_LAYOUT_MANAGER (manager), GTK_SIZE_REQUEST_CONSTANT_SIZE);
+  g_return_val_if_fail (priv->widget != NULL, GTK_SIZE_REQUEST_CONSTANT_SIZE);
 
   klass = GTK_LAYOUT_MANAGER_GET_CLASS (manager);
 


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