Commit 3bb404f4 authored by Matthias Clasen's avatar Matthias Clasen

Don't assert in gtk_event_controller_constructed

This prevents some of our generic object implementation tests
from working with gesture objects. Instead, add g_return_if_fail
checks in all the gesture constructors.
parent e4680d64
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment