GNOME Bugzilla – Bug 634677
assertion in finalize assuring that buffer is NULL is placed to early.
Last modified: 2011-01-28 19:53:12 UTC
Created attachment 174320 [details] [review]
Moves assertion checking for NULL buffer below setting it to NULL.
There is a code in gtktextview.c:3002:
3002:g_assert (priv->buffer == NULL);
3004:gtk_text_view_set_buffer (text_view, NULL);
Does assuring that buffer is NULL and, if this assertion passes, setting said NULL buffer to NULL again has any sense? From what I have seen gtk_text_view_destroy_layout () unrefs its reference to buffer, but it does not matter - this operation does not affect GtkTextView. Also gtk_text_view_set_buffer () sends a notification that buffer has probably changed. So I think that the assertion should be moved below gtk_text_view_set_buffer (), so it will catch the case when some notify handler recreated the buffer again.
This was spotted in GtkSourceView - bug #634510.
I'm attaching patch moving this assertion and commenting why it is here.
Can Krzesimir get permission to push this, please?
Sure, makes sense.
Thanks, pushed to master.