gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog server/array.cpp server/as_envi...


From: Sandro Santilli
Subject: Re: [Gnash-commit] gnash ChangeLog server/array.cpp server/as_envi...
Date: Tue, 20 Mar 2007 16:11:05 +0100

On Tue, Mar 20, 2007 at 03:01:21PM +0000, Sandro Santilli wrote:
> CVSROOT:      /sources/gnash
> Module name:  gnash
> Changes by:   Sandro Santilli <strk>  07/03/20 15:01:20

> Log message:
>               Reduce use of "dumb" pointers, using intrusive_ptr instead.
>               A side-effect is the player2.swf premature deletion assertion
>               is not triggered anymore now.

A few words on this.

One of the reason I started it was for as_value::to_object() to return 
a "smart" pointer rather then a dumb one. This was important to allow
automatic conversions of primitive values to instances of corresponding
classes (Number, Boolean, String) to be safe.

Generally speaking, we should NOT allow use of dumb pointers
on any ref_counted instance. This can be enforced by making the
constructors private / protected and providing named constructors
returning the smart pointer directly. This is not *mandatory*
when using intrusive pointers, but becomes when switching to
shared_ptr, in that while intrusive pointers relies on refcounting
being *embedded* in the stored instance, shared_ptr keeps the
refcounting outside, so it's impossible to keep it sane unless
we always deal with shared_ptr.

A plan could be to forbid dumb pointers NOW, while still using
intrusive_ptr, and later simply search&replace intrusive_ptr
with shared_ptr. Final step would then be using weak_ptr
where appropriate, or engage a GC to drop autonomous chains 
as a whole.

--strk;
~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]