Problem with memory management with builder.

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

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