Re: Problem with memory management with builder.

It become really strange when I additionally put treeview in glade. When I trying to delete treeview I get double delete and segmentation fault, but still it looks like button is not freed automatically.

W dniu 15 czerwca 2011 19:56 użytkownik Krzysztof Łochwinowicz <krzysztof lochwinowicz gmail com> napisał:
Hi *,
I was told that deleting a window object (created by gtk builder) will cause deletion of every window's child. Maybe I'm wrong but it looks like it does not.
Take a look on this small piece of code

int main(int argc, char** argv)
Gtk::Button* button;
    Gtk::Main kit(argc, argv);
    Gtk::Window* window;
    Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
    refBuilder->add_from_file("some.ui"); // with window and button
    refBuilder->get_widget("window1", window);
    refBuilder->get_widget("button1", button);
    delete window;
} // builder dies here..
delete button;  // Program exits normally, no double delete.

Why it behave so? I run this program in a loop (100 times) and memory usage still increasing. Even valgrind shows definitely lost memory.

Krzysztof Łochwinowicz

Krzysztof Łochwinowicz

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