Re: [[gtkmm] Glib::RefPtr also for Widgets?]
- From: Christof Petig <christof petig-baender de>
- To: Murray Cumming <murrayc usa net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [[gtkmm] Glib::RefPtr also for Widgets?]
- Date: Mon, 23 Sep 2002 12:56:38 +0200
Murray Cumming wrote:
Christof Petig <christof petig-baender de> wrote:
This leads to a new question:
How to destroy a gtkmm2 dialog within one of it's callbacks. I tried to
look inside the examples but got no clue [it looked to me like initial
allocation of a static widget and hiding/showing it - smells like a
widget leak]. In 1.2 this was the legitimate use for this->destroy(). I
even remember Gtk_Trashcan<> with horror ...
I even looked through the gtkmm2 docs, with no answer ... It sounded
like "delete this;" which really scares me.
It seems like "delete this" is what you want. If you just want to hide the
dialog then use hide().
Why would it be important to you to destroy the underlying C instance? We have
spent a long time ensuring that the lifetime of the C++ wrappers is tightly
bound to the lifetime of the C objects. I think it would be best to forget
about the underlying C instances whenever possible.
To put it simply:
I don't care about the C instance.
I need to clean up any memory associated with a specific window if the
user decides to not need it any longer.
E.g. create a window via new and forget about it. The window should
disappear from memory (C widget, C++ instance) once the user clicks
'seen it'.
So you propose "void seen_it_clicked() { delete this; }"? Perhaps my
aversion stems from bad experience with older gtkmm versions and is
unnecessary.
Christof
PS: What about the RefPtr to a Widget? Do you know whether it's possible?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]