[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h ser... [gnash
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h ser... [gnash_0_8_3_branch] |
Date: |
Fri, 30 May 2008 23:07:02 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch: gnash_0_8_3_branch
Changes by: Sandro Santilli <strk> 08/05/30 23:07:02
Modified files:
. : ChangeLog
gui : Player.cpp Player.h
server/parser : movie_def_impl.cpp movie_def_impl.h
movie_definition.h sprite_definition.h
server/swf : tag_loaders.cpp
Log message:
* gui/Player.{cpp,h}: keep the toplevel movie in an
intrusive_ptr
just in case someone else will get it in and out of one while
we're still using it (would prematurely destroy it).
* server/parser/: movie_definition.h, sprite_definition.h,
movie_def_impl.{cpp,h}:
Add new importResources() method taking care of IMPORT
details; have movie_def_impl maintain a list of movies
from which it imports from: fixes bug #23364.
* server/swf/tag_loaders.cpp (import_loader): just parse
and load the source movie, let the rest be done
by the new importResources() method.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.6573.2.43&r2=1.6573.2.44
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.109.2.3&r2=1.109.2.4
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.32&r2=1.32.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.106.2.1&r2=1.106.2.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.72.2.1&r2=1.72.2.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_definition.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.44&r2=1.44.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sprite_definition.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.42&r2=1.42.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.198&r2=1.198.2.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6573.2.43
retrieving revision 1.6573.2.44
diff -u -b -r1.6573.2.43 -r1.6573.2.44
--- ChangeLog 29 May 2008 15:11:56 -0000 1.6573.2.43
+++ ChangeLog 30 May 2008 23:06:59 -0000 1.6573.2.44
@@ -1,3 +1,17 @@
+2008-05-30 Sandro Santilli <address@hidden>
+
+ * gui/Player.{cpp,h}: keep the toplevel movie in an intrusive_ptr
+ just in case someone else will get it in and out of one while
+ we're still using it (would prematurely destroy it).
+ * server/parser/: movie_definition.h, sprite_definition.h,
+ movie_def_impl.{cpp,h}:
+ Add new importResources() method taking care of IMPORT
+ details; have movie_def_impl maintain a list of movies
+ from which it imports from: fixes bug #23364.
+ * server/swf/tag_loaders.cpp (import_loader): just parse
+ and load the source movie, let the rest be done
+ by the new importResources() method.
+
2008-05-29 Dossy Shiobara <address@hidden>
* libbase/utility.h,
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.109.2.3
retrieving revision 1.109.2.4
diff -u -b -r1.109.2.3 -r1.109.2.4
--- gui/Player.cpp 25 May 2008 18:13:03 -0000 1.109.2.3
+++ gui/Player.cpp 30 May 2008 23:07:01 -0000 1.109.2.4
@@ -219,10 +219,10 @@
#endif // def GNASH_FPS_DEBUG
}
-movie_definition*
+boost::intrusive_ptr<movie_definition>
Player::load_movie()
{
- gnash::movie_definition* md = NULL;
+ boost::intrusive_ptr<gnash::movie_definition> md;
RcInitFile& rcfile = RcInitFile::getDefaultInstance();
URL vurl(_url);
@@ -391,9 +391,16 @@
_gui->setStage(&root);
// Start loader thread
+ // NOTE: the loader thread might (in IMPORT tag parsing)
+ // create new movies and register them to the MovieLibrary.
+ // If MovieLibrary size exceeded, _movieDef might be
+ // destroyed prematurely. movie_root might actually be
+ // keeping it alive, as Gui might as well, but why relying
+ // on luck ? So we made sure to keep _movieDef by
+ // intrusive_ptr...
_movieDef->completeLoad();
- _gui->setMovieDefinition(_movieDef);
+ _gui->setMovieDefinition(_movieDef.get());
if (! _delay) {
_delay = static_cast<unsigned int>(1000 / movie_fps) ; // milliseconds
per frame
Index: gui/Player.h
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.h,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -b -r1.32 -r1.32.2.1
--- gui/Player.h 5 May 2008 18:58:05 -0000 1.32
+++ gui/Player.h 30 May 2008 23:07:01 -0000 1.32.2.1
@@ -26,6 +26,8 @@
#include "gnash.h" // needed for interface and fscommand callbacks
#include "sound_handler.h" // for visibility of sound_handler destructor
#include "gui.h"
+#include "movie_definition.h" // for visibility of movie_definition destructor
+#include "smart_ptr.h" // for intrusive_ptr holding of top-level movie
#include <string>
#include <map>
@@ -206,7 +208,7 @@
std::string _infile;
- movie_definition* _movieDef;
+ boost::intrusive_ptr<movie_definition> _movieDef;
unsigned long _maxAdvances;
@@ -216,7 +218,7 @@
/// stdin when it equals "-". May throw a GnashException
/// on failure.
///
- movie_definition* load_movie();
+ boost::intrusive_ptr<movie_definition> load_movie();
#ifdef GNASH_FPS_DEBUG
float _fpsDebugTime;
Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.106.2.1
retrieving revision 1.106.2.2
diff -u -b -r1.106.2.1 -r1.106.2.2
--- server/parser/movie_def_impl.cpp 15 May 2008 14:39:43 -0000
1.106.2.1
+++ server/parser/movie_def_impl.cpp 30 May 2008 23:07:01 -0000
1.106.2.2
@@ -1085,4 +1085,45 @@
}
#endif // GNASH_USE_GC
+void
+movie_def_impl::importResources(boost::intrusive_ptr<movie_definition> source,
Imports& imports)
+{
+ size_t importedSyms=0;
+ for (Imports::iterator i=imports.begin(), e=imports.end(); i!=e; ++i)
+ {
+ int id = i->first;
+ const std::string& symbolName = i->second;
+
+ boost::intrusive_ptr<resource> res =
source->get_exported_resource(symbolName);
+ if (!res)
+ {
+ log_error(_("import error: could not find resource '%s'
in movie '%s'"),
+ symbolName, source->get_url());
+ continue;
+ }
+ else if (font* f = res->cast_to_font())
+ {
+ // Add this shared font to the currently-loading movie.
+ add_font(id, f);
+ ++importedSyms;
+ }
+ else if (character_def* ch = res->cast_to_character_def())
+ {
+ // Add this character to the loading movie.
+ add_character(id, ch);
+ ++importedSyms;
+ }
+ else
+ {
+ log_error(_("importResources error: unsupported import
of '%s' from movie '%s' has unknown type"),
+ symbolName, source->get_url());
+ }
+ }
+
+ if ( importedSyms )
+ {
+ _importSources.insert(source);
+ }
+}
+
} // namespace gnash
Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.72.2.1
retrieving revision 1.72.2.2
diff -u -b -r1.72.2.1 -r1.72.2.2
--- server/parser/movie_def_impl.h 14 May 2008 05:40:59 -0000 1.72.2.1
+++ server/parser/movie_def_impl.h 30 May 2008 23:07:01 -0000 1.72.2.2
@@ -31,6 +31,7 @@
#include "StringPredicates.h" // for case-insensitive string comparision
(ExportMap)
#include <map> // for CharacterDictionary
+#include <set> // for _importSources
#include <string>
#include <memory> // for auto_ptr
#include <boost/thread/thread.hpp>
@@ -328,6 +329,9 @@
/// character_id is listed in the import table.
bool in_import_table(int character_id) const;
+ /// Movies we import resources from
+ std::set< boost::intrusive_ptr<movie_definition> > _importSources;
+
public:
movie_def_impl();
@@ -421,6 +425,8 @@
virtual void resolve_import(const std::string& source_url,
movie_definition* source_movie);
+ virtual void importResources(boost::intrusive_ptr<movie_definition>
source, Imports& imports);
+
void add_character(int character_id, character_def* c);
/// \brief
Index: server/parser/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_definition.h,v
retrieving revision 1.44
retrieving revision 1.44.2.1
diff -u -b -r1.44 -r1.44.2.1
--- server/parser/movie_definition.h 10 Apr 2008 03:52:07 -0000 1.44
+++ server/parser/movie_definition.h 30 May 2008 23:07:01 -0000 1.44.2.1
@@ -235,6 +235,22 @@
}
+ typedef std::pair<int, std::string> ImportSpec;
+ typedef std::vector< ImportSpec > Imports;
+
+ /// Import resources
+ //
+ /// @param source
+ /// Movie containing the resources being imported
+ ///
+ /// @param imports
+ /// Resources to import, each with the id to use in our dictionary
+ ///
+ virtual void importResources(boost::intrusive_ptr<movie_definition>
/*source*/, Imports& /*imports*/)
+ {
+ }
+
+
/// \brief
/// Get a character from the dictionary.
//
Index: server/parser/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sprite_definition.h,v
retrieving revision 1.42
retrieving revision 1.42.2.1
diff -u -b -r1.42 -r1.42.2.1
--- server/parser/sprite_definition.h 21 Apr 2008 11:27:46 -0000 1.42
+++ server/parser/sprite_definition.h 30 May 2008 23:07:01 -0000 1.42.2.1
@@ -196,6 +196,14 @@
return m_movie_def->get_exported_resource(sym);
}
+ /// Overridden just for complaining about malformed SWF
+ virtual void importResources(boost::intrusive_ptr<movie_definition>
/*source*/, Imports& /*imports*/)
+ {
+ IF_VERBOSE_MALFORMED_SWF (
+ log_swferror(_("IMPORT tag appears in DEFINESPRITE tag"));
+ );
+ }
+
/// \brief
/// Get a character_def from this Sprite's root movie
/// CharacterDictionary.
Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.198
retrieving revision 1.198.2.1
diff -u -b -r1.198 -r1.198.2.1
--- server/swf/tag_loaders.cpp 7 May 2008 09:15:17 -0000 1.198
+++ server/swf/tag_loaders.cpp 30 May 2008 23:07:02 -0000 1.198.2.1
@@ -59,6 +59,7 @@
#include <zlib.h>
#endif
#include <map>
+#include <utility> // for std::make_pair
namespace gnash {
@@ -1089,25 +1090,24 @@
IF_VERBOSE_PARSE
(
- log_parse(_(" import: version = %u, source_url = %s (%s), count =
%d"), import_version, abs_url.str().c_str(), source_url.c_str(), count);
+ log_parse(_(" import: version = %u, source_url = %s (%s),
count = %d"),
+ import_version, abs_url.str(), source_url, count);
);
// Try to load the source movie into the movie library.
- movie_definition* source_movie = NULL;
+ boost::intrusive_ptr<movie_definition> source_movie;
- if (s_no_recurse_while_loading == false)
- {
try {
source_movie = create_library_movie(abs_url);
} catch (gnash::GnashException& e) {
log_error(_("Exception: %s"), e.what());
- source_movie = NULL;
}
- if (source_movie == NULL)
+
+ if (!source_movie)
{
// Give up on imports.
- log_error(_("can't import movie from url %s"),
abs_url.str().c_str());
+ log_error(_("can't import movie from url %s"), abs_url.str());
return;
}
@@ -1120,7 +1120,8 @@
);
return;
}
- }
+
+ movie_definition::Imports imports;
// Get the imports.
for (int i = 0; i < count; i++)
@@ -1129,46 +1130,13 @@
boost::uint16_t id = in->read_u16();
std::string symbolName;
in->read_string(symbolName);
- IF_VERBOSE_PARSE
- (
- log_parse(_(" import: id = %d, name = %s"), id,
symbolName.c_str());
+ IF_VERBOSE_PARSE (
+ log_parse(_(" import: id = %d, name = %s"), id,
symbolName);
);
-
- if (s_no_recurse_while_loading)
- {
- m->add_import(source_url, id, symbolName.c_str()); // TODO: pass
the const ref of string instead
- }
- else
- {
- // @@ TODO get rid of this, always use
- // s_no_recurse_while_loading, change
- // create_movie().
-
- boost::intrusive_ptr<resource> res =
source_movie->get_exported_resource(symbolName);
- if (res == NULL)
- {
- log_error(_("import error: could not find resource '%s' in
movie '%s'"),
- symbolName.c_str(), source_url.c_str());
- }
- else if (font* f = res->cast_to_font())
- {
- // Add this shared font to the currently-loading movie.
- m->add_font(id, f);
- }
- else if (character_def* ch = res->cast_to_character_def())
- {
- // Add this character to the loading movie.
- m->add_character(id, ch);
- }
- else
- {
- log_error(_("import error: resource '%s' from movie '%s' has
unknown type"),
- symbolName.c_str(), source_url.c_str());
- }
- }
-
+ imports.push_back( std::make_pair(id, symbolName) );
}
+ m->importResources(source_movie, imports);
}
// Read a DefineText tag.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/Player.h ser... [gnash_0_8_3_branch],
Sandro Santilli <=