From 5639681f69abdce1ebfd3445497bea8b1fddddf7 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 19 Apr 2015 18:05:00 -0400 Subject: [PATCH] More TODOs. --- docs/lifetimes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/lifetimes.md b/docs/lifetimes.md index 680e942b..db0bf3cc 100644 --- a/docs/lifetimes.md +++ b/docs/lifetimes.md @@ -45,10 +45,12 @@ TODO write this ### Unix -All GtkWidgets are initially created "floating" (referenceless but unowned). When adding to a GtkContainer, the reference count is increased. When removing from a GtkContainer, the reference count is decreased. When the reference count drops back to zero, the widget is destroyed. Since containers are also widgets, when a container is destroyed, its children are removed (TODO verify this). +All GtkWidgets are initially created "floating" (referenceless but unowned). When adding to a GtkContainer, the reference count is increased. When removing from a GtkContainer, the reference count is decreased. When the reference count drops back to zero, the widget is destroyed. Since containers are also widgets, when a container is destroyed, its children are removed. An explicit call to `gtk_widget_destroy()` will immediately destroy the widget regardless of any refcounts. Container removal uses the refcounting functions `g_object_unref()`, not `gtk_widget_destroy()`. +TODO destroy rules are inaccurate + What these rules mean is that in the general case, you create widgets, add them to containers (which are themselves widgets, including GtkWindow), then destroy the uppermost container in the widget tree (usually a GtkWindow) to trigger the destruction of all the widgets. TODO describe what we need to do