Re: gtkmm 3.0.



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]