After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 634677 - assertion in finalize assuring that buffer is NULL is placed to early.
assertion in finalize assuring that buffer is NULL is placed to early.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 634510
 
 
Reported: 2010-11-12 12:18 UTC by Krzesimir Nowak
Modified: 2011-01-28 19:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Moves assertion checking for NULL buffer below setting it to NULL. (1004 bytes, patch)
2010-11-12 12:18 UTC, Krzesimir Nowak
accepted-commit_now Details | Review

Description Krzesimir Nowak 2010-11-12 12:18:33 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);
3002:
3003:gtk_text_view_destroy_layout (text_view);
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.
Comment 1 Murray Cumming 2011-01-28 09:37:59 UTC
Can Krzesimir get permission to push this, please?
Comment 2 Matthias Clasen 2011-01-28 15:00:35 UTC
Sure, makes sense.
Comment 3 Krzesimir Nowak 2011-01-28 19:53:12 UTC
Thanks, pushed to master.