diff options
-rw-r--r-- | gtk/gtkeventcontroller.c | 7 | ||||
-rw-r--r-- | gtk/gtkgesturedrag.c | 2 | ||||
-rw-r--r-- | gtk/gtkgesturelongpress.c | 2 | ||||
-rw-r--r-- | gtk/gtkgesturemultipress.c | 2 | ||||
-rw-r--r-- | gtk/gtkgesturerotate.c | 2 | ||||
-rw-r--r-- | gtk/gtkgestureswipe.c | 2 | ||||
-rw-r--r-- | gtk/gtkgesturezoom.c | 2 |
7 files changed, 16 insertions, 3 deletions
diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c index ba3c7c6d1d..b674380e19 100644 --- a/gtk/gtkeventcontroller.c +++ b/gtk/gtkeventcontroller.c @@ -115,8 +115,8 @@ gtk_event_controller_constructed (GObject *object) GtkEventControllerPrivate *priv; priv = gtk_event_controller_get_instance_private (controller); - g_assert (priv->widget != NULL); - _gtk_widget_add_controller (priv->widget, controller); + if (priv->widget) + _gtk_widget_add_controller (priv->widget, controller); } static void @@ -126,7 +126,8 @@ gtk_event_controller_dispose (GObject *object) GtkEventControllerPrivate *priv; priv = gtk_event_controller_get_instance_private (controller); - _gtk_widget_remove_controller (priv->widget, controller); + if (priv->widget) + _gtk_widget_remove_controller (priv->widget, controller); } static void diff --git a/gtk/gtkgesturedrag.c b/gtk/gtkgesturedrag.c index 3f8f1e1d71..0b53285cee 100644 --- a/gtk/gtkgesturedrag.c +++ b/gtk/gtkgesturedrag.c @@ -186,6 +186,8 @@ gtk_gesture_drag_init (GtkGestureDrag *gesture) GtkGesture * gtk_gesture_drag_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_DRAG, "widget", widget, NULL); diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c index 61e18d1c14..f2971b3b36 100644 --- a/gtk/gtkgesturelongpress.c +++ b/gtk/gtkgesturelongpress.c @@ -262,6 +262,8 @@ gtk_gesture_long_press_class_init (GtkGestureLongPressClass *klass) GtkGesture * gtk_gesture_long_press_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_LONG_PRESS, "widget", widget, NULL); diff --git a/gtk/gtkgesturemultipress.c b/gtk/gtkgesturemultipress.c index 3fbe20f5f6..1f499768fd 100644 --- a/gtk/gtkgesturemultipress.c +++ b/gtk/gtkgesturemultipress.c @@ -384,6 +384,8 @@ gtk_gesture_multi_press_init (GtkGestureMultiPress *gesture) GtkGesture * gtk_gesture_multi_press_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_MULTI_PRESS, "widget", widget, NULL); diff --git a/gtk/gtkgesturerotate.c b/gtk/gtkgesturerotate.c index e42f64174e..5b1aa7c917 100644 --- a/gtk/gtkgesturerotate.c +++ b/gtk/gtkgesturerotate.c @@ -188,6 +188,8 @@ gtk_gesture_rotate_class_init (GtkGestureRotateClass *klass) GtkGesture * gtk_gesture_rotate_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_ROTATE, "widget", widget, NULL); diff --git a/gtk/gtkgestureswipe.c b/gtk/gtkgestureswipe.c index 211789d2c6..0ca5bb35dc 100644 --- a/gtk/gtkgestureswipe.c +++ b/gtk/gtkgestureswipe.c @@ -237,6 +237,8 @@ gtk_gesture_swipe_init (GtkGestureSwipe *gesture) GtkGesture * gtk_gesture_swipe_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_SWIPE, "widget", widget, NULL); diff --git a/gtk/gtkgesturezoom.c b/gtk/gtkgesturezoom.c index a80ebd12bd..02e5a08695 100644 --- a/gtk/gtkgesturezoom.c +++ b/gtk/gtkgesturezoom.c @@ -181,6 +181,8 @@ gtk_gesture_zoom_class_init (GtkGestureZoomClass *klass) GtkGesture * gtk_gesture_zoom_new (GtkWidget *widget) { + g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); + return g_object_new (GTK_TYPE_GESTURE_ZOOM, "widget", widget, NULL); |