[gtk/wip/baedert/for-master: 5/12] widget: Use an unchecked cast in _get_native()



commit 49958528b63bdf1b544bfece75f83d9d3a32600f
Author: Timm Bäder <mail baedert org>
Date:   Wed Apr 29 08:07:45 2020 +0200

    widget: Use an unchecked cast in _get_native()
    
    This is either no chagne because we know for a fact that the returned
    value is a GtkNative - after all thats's the type we pass to
    gtk_widget_get_ancestor().
    
    Or it is a bug fix since casting NULL to a GtkNative using GTK_NATIVE()
    is not going to work, but the API contract of gtk_widget_get_native()
    explicitly allows a NULL return value.

 gtk/gtkwidget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 96844fa940..d789386b2e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6038,7 +6038,7 @@ gtk_widget_get_native (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  return GTK_NATIVE (gtk_widget_get_ancestor (widget, GTK_TYPE_NATIVE));
+  return (GtkNative *)gtk_widget_get_ancestor (widget, GTK_TYPE_NATIVE);
 }
 
 static void


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