gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] SWF input streams ownership


From: strk
Subject: [Gnash-dev] SWF input streams ownership
Date: Sun, 5 Nov 2006 01:07:11 +0100

I've been playing with memory leaks a bit, now have a question for you.
We have a couple of create_movie() functions that take either an URL
or a tu_file *.

The one taking an URL will create a tu_file and invoke the other.

In both cases ownership of the tu_file used for reading determines
a problem as callers will hardly know when the movie class has
finished with it, so don't know when it will be safe to delete
the tu_file.

Ok, they can just delete them at end of work, but do we
want to cleanup earlier then that instead ?

Our options seem to be:

        1) movie_def_impl takes ownership of the tu_file
        2) movie_def_impl broadcast a message telling
           user he has done with reading the SWF stream
        3) callers get a weak_ptr and keep checking for it
           (poll lifetime of movie_def_impl)
        4) callers simply delegate cleanups to a final cleanup
           call


The simplest seems number 4, whereas we might add a call to the
"internally-created tu_files" in the existing clear() function,
and make sure other tu_files (like the one created for stdin)
are properly deleted (Player destructor, for exapmle).

Number 1 would also be *very* simple, but I'm not sure tu_file
are copiable objects so that would prevent reuse of an opened
tu_file for multiple reads (but would we ever need that?).

I like Number 1, anyway (movie_def_impl takes ownership of the input stream).

What do you think ?


--strk;




reply via email to

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