[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54977] branches/soc-2008-mxcurioni/source /blender/freestyle/intern: Moved operations on blend file data from C++ class destructor to a specific method

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Mar 2 23:20:30 CET 2013


Revision: 54977
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54977
Author:   kjym3
Date:     2013-03-02 22:20:27 +0000 (Sat, 02 Mar 2013)
Log Message:
-----------
Moved operations on blend file data from C++ class destructor to a specific method
for releasing resources.  Based on review comment from Campbell.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Canvas.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StyleModule.h

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h	2013-03-02 20:46:37 UTC (rev 54976)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h	2013-03-02 22:20:27 UTC (rev 54977)
@@ -51,6 +51,10 @@
 
 	virtual ~BlenderStyleModule()
 	{
+	}
+
+	virtual void close()
+	{
 		BKE_text_unlink(G.main, _text);
 		BKE_libblock_free(&G.main->text, _text);
 	}

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Canvas.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Canvas.cpp	2013-03-02 20:46:37 UTC (rev 54976)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Canvas.cpp	2013-03-02 22:20:27 UTC (rev 54977)
@@ -140,7 +140,6 @@
 	update();
 }
 
-
 void Canvas::Clear()
 {
 	if (!_Layers.empty()) {
@@ -153,8 +152,10 @@
 
 	if (!_StyleModules.empty()) {
 		for (deque<StyleModule*>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; ++s) {
-			if (*s)
+			if (*s) {
+				(*s)->close();
 				delete (*s);
+			}
 		}
 		_StyleModules.clear();
 	}
@@ -234,7 +235,6 @@
 	}
 }
 
-
 void Canvas::SwapStyleModules(unsigned i1, unsigned i2)
 {
 	StyleModule *tmp;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StyleModule.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StyleModule.h	2013-03-02 20:46:37 UTC (rev 54976)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/StyleModule.h	2013-03-02 22:20:27 UTC (rev 54977)
@@ -98,6 +98,8 @@
 		return sl;
 	}
 
+	virtual void close() {}
+
 protected:
 	virtual int interpret()
 	{




More information about the Bf-blender-cvs mailing list