From: dooglus Date: Tue, 25 Nov 2008 01:22:17 +0000 (+0000) Subject: Define Canvas::show_externals() when _DEBUG is defined. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6d1e5a7b3d51889114374585024d3631d783c481;p=synfig.git Define Canvas::show_externals() when _DEBUG is defined. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2268 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/canvas.cpp b/synfig-core/trunk/src/synfig/canvas.cpp index 2e0144b..30697ef 100644 --- a/synfig-core/trunk/src/synfig/canvas.cpp +++ b/synfig-core/trunk/src/synfig/canvas.cpp @@ -1392,3 +1392,19 @@ Canvas::register_external_canvas(String file_name, Handle canvas) if(!is_absolute_path(file_name)) file_name = get_file_path()+ETL_DIRECTORY_SEPARATOR+file_name; externals_[file_name] = canvas; } + +#ifdef _DEBUG +void +Canvas::show_externals(String file, int line, String text) const +{ + printf(" .----- (externals for %lx '%s')\n | %s:%d %s\n", ulong(this), get_name().c_str(), file.c_str(), line, text.c_str()); + std::map::iterator iter; + for (iter = externals_.begin(); iter != externals_.end(); iter++) + { + synfig::String first(iter->first); + etl::loose_handle second(iter->second); + printf(" | %40s : %lx (%d)\n", first.c_str(), ulong(&*second), second->count()); + } + printf(" `-----\n\n"); +} +#endif // _DEBUG diff --git a/synfig-core/trunk/src/synfig/canvas.h b/synfig-core/trunk/src/synfig/canvas.h index 088c2e8..d2906be 100644 --- a/synfig-core/trunk/src/synfig/canvas.h +++ b/synfig-core/trunk/src/synfig/canvas.h @@ -543,6 +543,10 @@ public: void register_external_canvas(String file, Handle canvas); +#ifdef _DEBUG + void show_externals(String file, int line, String text) const; +#endif // _DEBUG + private: void add_group_pair(String group, etl::handle layer); void remove_group_pair(String group, etl::handle layer);