Re: Glib::RefPtr and Pointer
- From: Daniel Elstner <daniel kitta googlemail com>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: Glib::RefPtr and Pointer
- Date: Mon, 12 Nov 2007 18:31:55 +0100
Hi,
Am Freitag, den 09.11.2007, 08:34 +0100 schrieb Murray Cumming:
> > 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!
>
> We've all made that mistake once.
>
> I would rename the clear() method on some classes if it didn't meant
> that hundreds of applications would break.
If we ever get the opportunity to fix this, RefPtr<>::clear() should be
renamed to reset() -- analogous to std::auto_ptr<>::reset(). clear() is
for containers.
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]