Bugs item #1868911, was opened at 2008-01-10 23:29
Message generated for change (Comment added) made by dooglus
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=757416&aid=1868911&group_id=144022

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Crasher/nasty bug
Group: SVN version
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Genete (genete)
Assigned to: Nobody/Anonymous (nobody)
Summary: Exported canvases and its layers still not deleted

Initial Comment:
Using svn 1316

1) File New. Default setiings
2) New Circle
3) Encapsulate
4) Export canvas parameter
5) close Synfigstudio
6) Save? (no)

And the console says:

Application appears to have terminated successfully
synfig(14397) [22:45:15] error: 1 canvases not yet deleted!
synfig(14397) [22:45:15] error: 1 layers not yet deleted!


That's related with other bug I wrote:
 
https://sourceforge.net/tracker/?func=detail&aid=1848018&group_id=144022&atid=757416

-G

----------------------------------------------------------------------

>Comment By: dooglus (dooglus)
Date: 2008-02-01 12:54

Message:
Logged In: YES 
user_id=1546005
Originator: NO

I've been looking into this, and it's quite tricky.

The ValueBase class can hold various types (all 13 of Synfig's value
types).  This includes canvases as one of the types.  When:
  ValueBase::set(Canvas* x)
is used to set the value of a ValueBase object to be a canvas pointer, one
of the following is done:

        if(x && x->is_inline())
                _set(etl::handle<Canvas>(x));
        else
                _set(etl::loose_handle<Canvas>(x));

so whether or not the canvas' refcount is incremented depends on whether
the canvas is inline *at the moment*.

Similarly when we put a loose_handle<Canvas> or a handle<Canvas> into a
ValueBase - we convert both types to handle<Canvas>(x) (if inline) or to
loose_handle<Canvas>(x) (otherwise).

Then, later, when we've finished with the ValueBase, we ValueBase::clear()
it's value, and if it's a canvas value:

etl::handle<Canvas> canvas(get(etl::loose_handle<Canvas>()));
if(canvas && canvas->is_inline())
        delete static_cast<etl::handle<Canvas>*>(data);
else
        delete static_cast<etl::loose_handle<Canvas>*>(data);

ie. we unreference it only if it is inline now.

Well, the problem is what happens if a canvas wasn't inline when you put
it into the ValueBase, but it IS inline when you clear the ValueBase later?
 You ref but never unref, the refcount never goes below 1 and the "canvas
not yet deleted" on exit.  (the "layer not yet deleted" is probably because
the canvas is holding a reference to it - fix the canvas problem & the
layer problem gets fixed too).

Do we need to adjust the count when changing a value from inline to
exported?  Or keep the two types of value (inline and not) in different
types of ValueBase?

----------------------------------------------------------------------

Comment By: Genete (genete)
Date: 2008-01-11 10:51

Message:
Logged In: YES 
user_id=1874777
Originator: YES

File Added: blinepoint_icon.sif

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=757416&aid=1868911&group_id=144022

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to