X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkcols.c;h=c0a0ed8df35351e5b33cd6aeda5749c19e7fcb00;hb=refs%2Fheads%2Fbranch-0.56;hp=d4c936795ff54c1e16c4971c95eaaf2a8e8dc626;hpb=df85003ea56581734754d7404fa08e4081f9dd34;p=PuTTY.git diff --git a/unix/gtkcols.c b/unix/gtkcols.c index d4c93679..c0a0ed8d 100644 --- a/unix/gtkcols.c +++ b/unix/gtkcols.c @@ -250,7 +250,7 @@ static void columns_forall(GtkContainer *container, gboolean include_internals, { Columns *cols; ColumnsChild *child; - GList *children; + GList *children, *next; g_return_if_fail(container != NULL); g_return_if_fail(IS_COLUMNS(container)); @@ -260,9 +260,19 @@ static void columns_forall(GtkContainer *container, gboolean include_internals, for (children = cols->children; children && (child = children->data); - children = children->next) + children = next) { + /* + * We can't wait until after the callback to assign + * `children = children->next', because the callback might + * be gtk_widget_destroy, which would remove the link + * `children' from the list! So instead we must get our + * hands on the value of the `next' pointer _before_ the + * callback. + */ + next = children->next; if (child->widget) callback(child->widget, callback_data); + } } static GtkType columns_child_type(GtkContainer *container)