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 659350 - Gtk.TextBuffer.insert(): the TextIter is a ref argument
Gtk.TextBuffer.insert(): the TextIter is a ref argument
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GTK+ GStreamer WebKitGTK+
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-17 20:25 UTC by Sébastien Wilmet
Modified: 2011-09-19 19:03 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2011-09-17 20:25:18 UTC
The API for gtk_text_buffer_insert() says:

> iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text

But here is an example of a C code generated with Vala 0.14:

_tmp17_ = doc;
_tmp18_ = *iter;
_tmp19_ = text_to_insert;
gtk_text_buffer_insert (_tmp17_, &_tmp18_, _tmp19_, -1);

It should be directly "iter" instead of "&_tmp18_" for the second argument, or reassigning iter to tmp18 afterwards.

It's maybe a GObject Introspection tag that is missing in GTK+.
Comment 1 Luca Bruno 2011-09-19 19:03:57 UTC
commit 86f29dd04c4482889c913ffa9dd4f79515055de9
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Mon Sep 19 21:01:17 2011 +0200

    gtk+-2.0, gtk+-3.0: Make TextBuffer.insert iter parameter be ref
    
    The insert method will update the iter to point to the end of the
    inserted text.
    
    Fixes bug 659350.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.