diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2014-02-12 15:56:11 +0000 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-08-14 19:52:59 +0200 |
commit | e853007cd0186e141559b967af852156477092b3 (patch) | |
tree | 827d048846f718e394383ac3b94faf4f5458d7c6 /gtk/gtkstatusbar.c | |
parent | 2120ccfd5e87dd7a86bf8736616b75454ef02f6e (diff) | |
download | gtk+-e853007cd0186e141559b967af852156477092b3.tar.gz |
Statusbar: Remove matching messages before popping
gtk_statusbar_remove_all() was popping the top message if its
context_id matched before removing other matching messages from the
stack. This meant that if the context_id of the second top message
matched it was still displayed when the top message was popped and
then removed from the list of messages without updating the display.
Fix this by removing all the matching messages below the top one
before popping it if it matches.
https://bugzilla.gnome.org/show_bug.cgi?id=724281
Diffstat (limited to 'gtk/gtkstatusbar.c')
-rw-r--r-- | gtk/gtkstatusbar.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index a49457f0f3..18f974e6bb 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -456,21 +456,13 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar, if (priv->messages == NULL) return; - msg = priv->messages->data; - - /* care about signal emission if the topmost item is removed */ - if (msg->context_id == context_id) - { - gtk_statusbar_pop (statusbar, context_id); - - prev = NULL; - list = priv->messages; - } - else - { - prev = priv->messages; - list = prev->next; - } + /* We special-case the topmost message at the bottom of this + * function: + * If we need to pop it, we have to update various state and we want + * an up-to-date list of remaining messages in that case. + */ + prev = priv->messages; + list = prev->next; while (list != NULL) { @@ -478,21 +470,12 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar, if (msg->context_id == context_id) { - if (prev == NULL) - priv->messages = list->next; - else - prev->next = list->next; + prev->next = list->next; gtk_statusbar_msg_free (msg); g_slist_free_1 (list); - if (prev == NULL) - prev = priv->messages; - - if (prev) - list = prev->next; - else - list = NULL; + list = prev->next; } else { @@ -500,6 +483,13 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar, list = prev->next; } } + + /* Treat topmost message here */ + msg = priv->messages->data; + if (msg->context_id == context_id) + { + gtk_statusbar_pop (statusbar, context_id); + } } /** |