From fb87cd1c5d39d863a12745684728ab12edf1f0db Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 4 Nov 2011 01:30:40 +0100 Subject: [PATCH] app: don't leak the list returned by gimp_get_image_windows() --- app/actions/dialogs-actions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c index e869e2b3da..5321e3d097 100644 --- a/app/actions/dialogs-actions.c +++ b/app/actions/dialogs-actions.c @@ -273,7 +273,6 @@ dialogs_actions_toolbox_exists (Gimp *gimp) { GimpDialogFactory *factory = gimp_dialog_factory_get_singleton (); GimpSessionInfo *info = NULL; - GList *windows = gimp ? gimp_get_image_windows (gimp) : NULL; gboolean toolbox_found = FALSE; GList *iter; @@ -284,16 +283,20 @@ dialogs_actions_toolbox_exists (Gimp *gimp) /* Then in image windows */ if (! toolbox_found) { + GList *windows = gimp ? gimp_get_image_windows (gimp) : NULL; + for (iter = windows; iter; iter = g_list_next (iter)) { GimpImageWindow *window = GIMP_IMAGE_WINDOW (windows->data); - + if (gimp_image_window_has_toolbox (window)) { toolbox_found = TRUE; break; } } + + g_list_free (windows); } return toolbox_found;