|
Boost Users : |
Subject: Re: [Boost-users] enabled_shared_from_this: bad_weak_ptr exception + online doc explanation
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-09-08 09:04:49
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Saturday 06 September 2008 15:10 pm, Igor R wrote:
> > TextTool::TextTool(QDialog *taskDialogue) : Tool(this->name)
> > {
> > boost::shared_ptr<TextTool> pointerToThis =
> > TextTool::shared_from_this(); //ERROR OCCURS ON THIS LINE
> >
> > bold = boost::shared_ptr<ToggleControl>(new
> > ToggleControl(pointerToThis));
> > }
>
> You cannot call shared_from_this in the constructor. Instead, you can
> define a static constructing method, like this:
Actually, you can use shared_from_this with the boost from svn trunk. I don't
know when/if this feature will make it into a release though.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFIxSLy5vihyNWuA4URAtZ2AJ4vrARqO6k15uk8wskm5ml4MDURsQCgiIaY
0KZx8D/jKW75e71dkazGLnY=
=rqYm
-----END PGP SIGNATURE-----
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net