Check if buffer is NULL after setting it to NULL, not before.

This catches cases when "notify::buffer" handler does not recreate
the buffer again, which could end in reference leak.

https://bugzilla.gnome.org/show_bug.cgi?id=634677
(cherry picked from commit d688343a31)
This commit is contained in:
Matthias Clasen 2011-01-29 22:40:41 -05:00
parent 840c9aa8d9
commit bb8e1c67c6

View File

@ -2923,10 +2923,11 @@ gtk_text_view_finalize (GObject *object)
text_view = GTK_TEXT_VIEW (object);
priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
g_assert (text_view->buffer == NULL);
gtk_text_view_destroy_layout (text_view);
gtk_text_view_set_buffer (text_view, NULL);
/* at this point, no "notify::buffer" handler should recreate the buffer. */
g_assert (priv->buffer == NULL);
cancel_pending_scroll (text_view);