gtk_container_remove may generate some noise for a GC

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?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]