2011/1/28 Culpian Camilo Martin <[email protected]>: > 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(); _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
