as Mitch pointed out we used to leak GList memory here. The new

2000-10-18  Sven Neumann  <sven@gimp.org>

	* app/cursorutil.c (gtkutil_compress_motion): as Mitch pointed out we
	used to leak GList memory here. The new implementation should be
	faster too, since it prepends to the list instead of appending.
This commit is contained in:
Sven Neumann 2000-10-18 17:51:25 +00:00 committed by Sven Neumann
parent f9e6d16cc3
commit 22616e80f4
3 changed files with 30 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2000-10-18 Sven Neumann <sven@gimp.org>
* app/cursorutil.c (gtkutil_compress_motion): as Mitch pointed out we
used to leak GList memory here. The new implementation should be
faster too, since it prepends to the list instead of appending.
2000-10-18 Michael Natterer <mitch@gimp.org> 2000-10-18 Michael Natterer <mitch@gimp.org>
* plug-ins/helpbrowser/Makefile.am: added $GTK_CFLAGS and $GTK_LIBS. * plug-ins/helpbrowser/Makefile.am: added $GTK_CFLAGS and $GTK_LIBS.

View File

@ -511,8 +511,9 @@ gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_y) gdouble *lastmotion_y)
{ {
GdkEvent *event; GdkEvent *event;
GList *requeued_events = NULL; GList *requeued_events = NULL;
gboolean success = FALSE; GList *list;
gboolean success = FALSE;
/* Move the entire GDK event queue to a private list, filtering /* Move the entire GDK event queue to a private list, filtering
out any motion events for the desired widget. */ out any motion events for the desired widget. */
@ -535,20 +536,22 @@ gtkutil_compress_motion (GtkWidget *widget,
} }
else else
{ {
requeued_events = g_list_append (requeued_events, event); requeued_events = g_list_prepend (requeued_events, event);
} }
} }
/* Replay the remains of our private event list back into the /* Replay the remains of our private event list back into the
event queue in order. */ event queue in order. */
while (requeued_events)
{
gdk_event_put ((GdkEvent*) requeued_events->data);
gdk_event_free ((GdkEvent*) requeued_events->data); requeued_events = g_list_reverse (requeued_events);
requeued_events =
g_list_remove_link (requeued_events, requeued_events); for (list = requeued_events; list; list = g_list_next (list))
{
gdk_event_put ((GdkEvent*) list->data);
gdk_event_free ((GdkEvent*) list->data);
} }
g_list_free (requeued_events);
return success; return success;
} }

View File

@ -511,8 +511,9 @@ gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_y) gdouble *lastmotion_y)
{ {
GdkEvent *event; GdkEvent *event;
GList *requeued_events = NULL; GList *requeued_events = NULL;
gboolean success = FALSE; GList *list;
gboolean success = FALSE;
/* Move the entire GDK event queue to a private list, filtering /* Move the entire GDK event queue to a private list, filtering
out any motion events for the desired widget. */ out any motion events for the desired widget. */
@ -535,20 +536,22 @@ gtkutil_compress_motion (GtkWidget *widget,
} }
else else
{ {
requeued_events = g_list_append (requeued_events, event); requeued_events = g_list_prepend (requeued_events, event);
} }
} }
/* Replay the remains of our private event list back into the /* Replay the remains of our private event list back into the
event queue in order. */ event queue in order. */
while (requeued_events)
{
gdk_event_put ((GdkEvent*) requeued_events->data);
gdk_event_free ((GdkEvent*) requeued_events->data); requeued_events = g_list_reverse (requeued_events);
requeued_events =
g_list_remove_link (requeued_events, requeued_events); for (list = requeued_events; list; list = g_list_next (list))
{
gdk_event_put ((GdkEvent*) list->data);
gdk_event_free ((GdkEvent*) list->data);
} }
g_list_free (requeued_events);
return success; return success;
} }