Follow-up Comment #2, bug #19064 (project freeciv):

I don't have a complete picture of what's going on yet, but I'm a little
dubious about this code in gui-gtk-2.0/chatline.c:apply_text_tag():


  GtkTextBuffer *buf;
  /* ... */
  case TTT_COLOR:
    {
      /* We have to make a new tag every time. */
      GtkTextTag *tag = NULL;
      /* ... */
      tag = gtk_text_buffer_create_tag(buf, NULL, /* ... */);
      /* ... */
      gtk_text_buffer_apply_tag(buf, tag, /* ... */);
      g_object_unref(G_OBJECT(tag)); /* Bad? */
    }


Looking at the gtk_text_buffer_create_tag() docs
<http://developer.gnome.org/gtk/2.24/GtkTextBuffer.html#gtk-text-buffer-create-tag>,
I _think_ that the ownership of the created tag is passed to a structure
inside 'buf', so the caller doesn't have to free it. The annotation "transfer
none" apparently
<http://developer.gnome.org/gtk/2.24/annotation-glossary.html#glsT> means
"Don't free data after the code is done", which I think may corroborate my
argument.

The same applies to case TTT_LINK.

This server uses loads of colours, though, so I'm not sure why we're not
seeing loads of these warnings. Perhaps the reference count only drops below
zero in unusual circumstances. Or perhaps this possible thing I've found has
nothing to do with these warnings.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?19064>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to