Re: Re:
- From: Krzesimir Nowak <qdlacz gmail com>
- To: Culpian Camilo Martin <camiloculpian gmail com>
- Cc: Murray Cumming <murrayc murrayc com>, gtkmm-list gnome org
- Subject: Re: Re:
- Date: Fri, 28 Jan 2011 14:46:21 +0100
2011/1/28 Culpian Camilo Martin <camiloculpian gmail com>:
> ok, i'll try it, i have had some troubles doing this:
>
> class foo
> {
> static ref_ptr<foo> create
> (
> return ref_ptr<foo>(new foo());
> );
> foo();
> ~foo();
> ref_ptr<foo> set_something()
> {
> //set something
>
> return ref_ptr<foo>(this);
> //for using foo->set_something()->set_something();
> // oviously the ref_ptr delete "this", and cause a segfault
> // any idea how can avoid this?
> }
> }
Would be good to show what is this ref_ptr class...
If the below code segfaults then maybe copy constructor of ref_ptr
does not increment reference count.
ref_ptr<foo> f = foo::create();
f->set_something()->set_something();
- Follow-Ups:
- Re: Re:
- From: Culpian Camilo Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]