Skip to content
  • Orivej Desh's avatar
    Zero-fill new GtkTextIter · f6bc2415
    Orivej Desh authored and Matthias Clasen's avatar Matthias Clasen committed
    iter_init_common() is used on uninitialized GtkTextIter, and since neither it
    nor its callers initiliaze its padding fields, they contain garbage.
    
    This is a problem for Go - which checks that structs passed to C functions do
    not contain pointers to Go-allocated memory - when the garbage happens to be
    such a pointer.  Although Go zero-fills all GtkTextIter that it allocates, this
    does not help when GTK functions such as insert_pixbuf_or_widget_segment called
    for gtk_text_buffer_create_child_anchor copy garbage from their stack-allocated
    GtkTextIter into a clean iter.  To work around this a GtkTextIter has to be
    discraded after use in text buffer anchor inserting functions:
    https://github.com/gotk3/gotk3/pull/307
    f6bc2415