POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
29 Jul 2024 20:24:00 EDT (-0400)
  Re: A tale of two cities  
From: Warp
Date: 14 Mar 2012 13:12:37
Message: <4f60d184@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> >    Module A has a reference-counting smart pointer pointing to an object B.
> >
> >    A member function of that object B calls a function of module A. Said
> > function of A drops the reference to object B. Since it was the only
> > reference pointing to it, the object B gets deleted. When the function
> > in A ends, the execution returns to the member function of B, which now
> > operates on a deleted object. Undefined behavior ensues.
> >
> >    Yes, that *can* happen.

> Hm... you do have a point there.

  I learned it the hard way. Yes, it happened to me in an actual project,
and I didn't know of this problem before that.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.