Reference counting and LablGTK

Edouard <[email protected]> Thu, 24 Sep 2009 07:52:53 +0200
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <1253771573.5290.2.camel@edouard-laptop>
Hello,

I'm writting an application which loads some symbol tables at startup.
Symbol tables are GtkTable widgets with many GtkButton inside. Each
GtkButton displays a symbol (PNG file). The application currently have
8 symbol tables; as a result, the whole loading time is quite long
(about one third of the whole loading time). Symbol tables are stored
in a hash table and always displayed one by one (the previously shown
symbol table is removed from its container (GtkScrolledWindow), then
replaced by the new one).

One way to reduce loading time is using OCaml lazy features. Symbol
table are thus loaded when needed, and not necessarily at startup. But
this results in a totally unexpected behavior. The first time the
symbol table is displayed in the scrolled window, everything works
well. But the next times, every GtkButton have disappeared. Maybe it is
a reference counting related problem. So is there a way to manually
manipulate ref values in LablGTK (I know there is a dedicated function
in GTK, gtk_widget_ref, but was it wrapped for OCaml) ? Or maybe there
is a workaround to avoid using this function.

Thank you in advance for your help.

Best regards,
Edouard