GNOME Bugzilla – Bug 789149
GtkGestureZoom leaks the list of sequences while calculating the distance between touch points
Last modified: 2017-10-19 08:31:08 UTC
In the unexpected case where an attempt is made to calculate the distance without a sufficient number of event sequences, the list gets leaked. I am not sure if this can actually happen, but maybe it is a possibility when invoked via gtk_gesture_zoom_get_scale_delta? If it can't happen, then maybe we should turn it into an assertion instead?
Created attachment 361805 [details] [review] [gtk-3-22] GtkGestureZoom: Don't leak the list of sequences I don't have a touchscreen right now, so this is only compile tested at the moment. I'll test it later when I have my other laptop.
Created attachment 361808 [details] [review] [master] GtkGestureZoom: Don't leak the list of sequences
Review of attachment 361805 [details] [review]: Nice catch! I have a comment that applies to both patches, feel free to push after fixing locally. ::: gtk/gtkgesturezoom.c @@ +110,2 @@ gtk_gesture_get_point (gesture, sequences->data, &x1, &y1); gtk_gesture_get_point (gesture, sequences->next->data, &x2, &y2); Patch context doesn't show it, but there's a g_list_free (sequences) call right below these calls that should now be removed if we are handling it at the end of the function.
Created attachment 361843 [details] [review] [master] GtkGestureZoom: Don't leak the list of sequences
Created attachment 361844 [details] [review] [gtk-3-22] GtkGestureZoom: Don't leak the list of sequences
(In reply to Carlos Garnacho from comment #3) > Review of attachment 361805 [details] [review] [review]: Thanks for taking a look! > ::: gtk/gtkgesturezoom.c > @@ +110,2 @@ > gtk_gesture_get_point (gesture, sequences->data, &x1, &y1); > gtk_gesture_get_point (gesture, sequences->next->data, &x2, &y2); > > Patch context doesn't show it, but there's a g_list_free (sequences) call > right below these calls that should now be removed if we are handling it at > the end of the function. Oops, sorry about that. I fixed that and tested them both on a touchscreen - gtk4-demo for master, and gnome-photos for gtk-3-22.