Re: Gtk::Notebook memory management quirks



2008/7/23 Murray Cumming <murrayc murrayc com>:

I don't think that the builder should delete widgets. Do you have a
simple-as-possible compileable test case that shows this? If so, could
you please add it to bugzilla?


I load the widgets that are displayed on the notebook tab from a GtkBuilder file.
Multiple tabs can be opened, so I need to create a new GtkBuilder for each tab. (I didn't find another way to replicate the widgets created by the GtkBuilder).
Each of these GtkBuilder files has a VBox with the notebook contents which is then added to the notebook as the child widget.
Once the tab is closed I release the last reference to the RefPtr<GtkBuilder> (Of course I need to make sure that no one else also holds a reference to the same GtkBuilder). The GtkBuilder will then release the VBox.
I first thought that the VBox is released by the notebook but then I realized that it's the GtkBuilder of course.

It's all a big hack of course but as I said earlier I didn't find another clever way to replicate widgets that come from a GtkBuilder (I'd need something like a clone factory with the GtkBuilder providing the examplar objects but as far as I know widgets can't be copied or cloned)

-Julien


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