mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
Merge branch 'fix-gtkgesturerotate-potential-leak' into 'master'
gtkgesturerotate: Fix a memory leak See merge request GNOME/gtk!1260
This commit is contained in:
commit
08f7526f8f
@ -82,21 +82,21 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
|
|||||||
gdouble x1, y1, x2, y2;
|
gdouble x1, y1, x2, y2;
|
||||||
GtkGesture *gesture;
|
GtkGesture *gesture;
|
||||||
gdouble dx, dy;
|
gdouble dx, dy;
|
||||||
GList *sequences;
|
GList *sequences = NULL;
|
||||||
GdkTouchpadGesturePhase phase;
|
GdkTouchpadGesturePhase phase;
|
||||||
|
gboolean retval = FALSE;
|
||||||
|
|
||||||
gesture = GTK_GESTURE (rotate);
|
gesture = GTK_GESTURE (rotate);
|
||||||
priv = gtk_gesture_rotate_get_instance_private (rotate);
|
priv = gtk_gesture_rotate_get_instance_private (rotate);
|
||||||
|
|
||||||
if (!gtk_gesture_is_recognized (gesture))
|
if (!gtk_gesture_is_recognized (gesture))
|
||||||
return FALSE;
|
goto out;
|
||||||
|
|
||||||
sequences = gtk_gesture_get_sequences (gesture);
|
sequences = gtk_gesture_get_sequences (gesture);
|
||||||
if (!sequences)
|
if (!sequences)
|
||||||
return FALSE;
|
goto out;
|
||||||
|
|
||||||
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
|
last_event = gtk_gesture_get_last_event (gesture, sequences->data);
|
||||||
|
|
||||||
gdk_event_get_touchpad_gesture_phase (last_event, &phase);
|
gdk_event_get_touchpad_gesture_phase (last_event, &phase);
|
||||||
|
|
||||||
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
|
if (gdk_event_get_event_type (last_event) == GDK_TOUCHPAD_PINCH &&
|
||||||
@ -109,11 +109,10 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!sequences->next)
|
if (!sequences->next)
|
||||||
return FALSE;
|
goto out;
|
||||||
|
|
||||||
gtk_gesture_get_point (gesture, sequences->data, &x1, &y1);
|
gtk_gesture_get_point (gesture, sequences->data, &x1, &y1);
|
||||||
gtk_gesture_get_point (gesture, sequences->next->data, &x2, &y2);
|
gtk_gesture_get_point (gesture, sequences->next->data, &x2, &y2);
|
||||||
g_list_free (sequences);
|
|
||||||
|
|
||||||
dx = x1 - x2;
|
dx = x1 - x2;
|
||||||
dy = y1 - y2;
|
dy = y1 - y2;
|
||||||
@ -127,7 +126,11 @@ _gtk_gesture_rotate_get_angle (GtkGestureRotate *rotate,
|
|||||||
*angle = fmod (*angle, 2 * G_PI);
|
*angle = fmod (*angle, 2 * G_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
retval = TRUE;
|
||||||
|
|
||||||
|
out:
|
||||||
|
g_list_free (sequences);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user