[gimp/soc-2010-cage] app: add comment about why we can't use GimpContainerView API in init()



commit 0ba15530de753511c30dd7f6c68bab4ede48d6f3
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 24 12:50:56 2010 +0200

    app: add comment about why we can't use GimpContainerView API in init()

 app/widgets/gimpcontainerbox.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcontainerbox.c b/app/widgets/gimpcontainerbox.c
index 4a520cb..685b195 100644
--- a/app/widgets/gimpcontainerbox.c
+++ b/app/widgets/gimpcontainerbox.c
@@ -105,6 +105,18 @@ gimp_container_box_constructed (GObject *object)
 {
   GimpContainerBox *box = GIMP_CONTAINER_BOX (object);
 
+  /* This is evil: the hash table of "insert_data" is created on
+   * demand when GimpContainerView API is used, using a
+   * value_free_func that is set in the interface_init functions of
+   * its implementors. Therefore, no GimpContainerView API must be
+   * called from any init() function, because the interface_init()
+   * function of a subclass that sets the right value_free_func might
+   * not have been called yet, leaving the insert_data hash table
+   * without memory management.
+   *
+   * Call GimpContainerView API from GObject::constructed() instead,
+   * which runs after everything is set up correctly.
+   */
   gimp_container_view_set_dnd_widget (GIMP_CONTAINER_VIEW (box),
                                       box->scrolled_win);
 



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