[gtk+/gtk-2-24] Check if buffer is NULL after setting it to NULL, not before.
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Check if buffer is NULL after setting it to NULL, not before.
- Date: Sun, 30 Jan 2011 04:34:07 +0000 (UTC)
commit bb8e1c67c6e9b20a4a13d5d95a8d809d260e31e1
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 29 22:40:41 2011 -0500
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 d688343a31dbe67f34228b998bbb753584d8d2e9)
gtk/gtktextview.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 2d1a20b..42903b5 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]