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



commit 8eb0fedfdc14eb4830f243b911028302e152009b
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 463d1319e7..c5dca9447d 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6053,7 +6053,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]