Re: Glib::RefPtr and Pointer



Am Thu, 08 Nov 2007 08:52:44 +0100 schrieb Murray Cumming:

> Yes. You need to check pointers (or RefPtrs) for null before
> dereferencing them. For instance
> if(list_store)
>   list_store->do_something().

After some hours of searching I found the problem.

Glib::RefPtr<Gtk::ListStore> m_refListModel;
...

Now I tried to clear my ListStore:

m_refListModel.clear ();

This compiled nice, but m_refListModel was NULL after calling this.

m_refListModel->clear ();

This worked as I expected. After reading the documentation of RefPtr, I
know the problem. This was a *really* hard to find bug!

regards
Andreas


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