gtk_container_remove may generate some noise for a GC

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

gtk_container_remove may generate some noise for a GC

Stefan Salewski-2
https://github.com/GNOME/gtk/blob/master/gtk/gtkcontainer.c

void
gtk_container_remove (GtkContainer *container,
                      GtkWidget    *widget)
{
  g_return_if_fail (GTK_IS_CONTAINER (container));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  g_object_ref (container);
  g_object_ref (widget);

  g_signal_emit (container, container_signals[REMOVE], 0, widget);

  _gtk_container_accessible_remove (GTK_WIDGET (container), widget);

  g_object_unref (widget);
  g_object_unref (container);
}

Well, now I understand the origin of some debug messages I may get from
my Nim bindings code.

Why has gtk_container_remove() to call ref/unref on widget and
container? My assumption was, that gtk_container_remove() is an atomic
action. And GTK is single threaded? Is that already preparation for a
multi-threaded GTK4?
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk_container_remove may generate some noise for a GC

Paul Davis


On Sun, Jun 25, 2017 at 1:56 PM, Stefan Salewski <[hidden email]> wrote:

action. And GTK is single threaded? Is that already preparation for a
multi-threaded GTK4?

like most GUI toolkits that had deep origins in the X Window world, GTK is single threaded. there is support for multiple threads if the application developer wants to use them, and you can certainly have multiple glib event loops running in multiple threads, but the core design of GTK itself is single threaded.

it's just the right thing to do.
 

_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Loading...