Re: gtkmm 3.0.
- From: Murray Cumming <murrayc murrayc com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list gnome org
- Subject: Re: gtkmm 3.0.
- Date: Thu, 25 Mar 2010 18:31:01 +0100
On Thu, 2010-03-25 at 14:08 +0000, Chris Vine wrote:
> Glib::WeakPtr<Gtk::TreeSelection> s = tree_view.get_selection();
> ...
> [some code blocks later]
> { // scope block for Lock
> Glib::WeakPtr<Gtk::TreeSelection>::Lock(s); // take a strong
> reference
> if (s) s->set_mode(Gtk::SELECTION_SINGLE);
> }
> ...
I understand that this might be more correct, but:
a) This doesn't honestly feel very useful in this case. I'm not likely
to write code that tries to use the TreeSelection after the TreeView has
been destroyed. Yes, it can happen, but not intentionally. So I'm not
likely anyway to bother to check the pointer before dereferencing it.
b) If I do this with RefPtr now, I guess that it doesn't crash. Maybe it
has no effect, which also seems OK.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]