Re: reference pointer in the custom container (was: Re: preferred way to destroy a window)
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: gtkmm-list gnome org
- Cc: Murray Cumming <murrayc murrayc com>
- Subject: Re: reference pointer in the custom container (was: Re: preferred way to destroy a window)
- Date: Sat, 5 Aug 2006 00:07:24 +0300
Murray Cumming wrote:
> Glib::RefPtr is not for use with widgets. It is for use with classes that
> do not allow you to use them without RefPtr. See the gtkmm book for more
> detailed documentaiton. If you did use it then you would have to be a lot
> more careful about whether or not it had a starting reference.
In plain GTK+ it is common to reference a widget to make sure it is not
destroyed before the reference keeper. And widgets are not different from
other objects in this respect.
> If what you actually want is for the child to be deleted automatically
> when the window is deleted, then just use Gtk::manage(). Again, this is in
> gtkmm book.
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch03s02.html
> and
> http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch20.html
>
> Do make sure you've read that Basics chapter. It will save you lots of time.
I have read the books. It says nothing about how the manage() works and I
assumed all the way that it destroys C++ object when underlying C object's
reference count drops to zero i.e. when C object is destroyed. In this case,
an additional RefPtr shouldn't hurt, but apparently it does. And I consider
it wrong.
Anyway, RefPtr is not very important in _this_ case.
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]