diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-04-09 04:46:49 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-04-09 04:46:49 +0400 |
commit | 800f86c8454ced85c29d1dcb04dcb163689a89d3 (patch) | |
tree | 4598a2ea78a1d1cf6a4c0a9e7030de4c826a006d /source/blender/freestyle/intern/system | |
parent | e6bd510dde6289efcead80e3d21cb21876282a56 (diff) |
Attempt to fix a potential name conflict between Freestyle and the compositor.
A crash in the Freestyle renderer was reported by Ton on IRC with a stack trace
below. Note that #2 is in Freestyle, whereas #1 is in the compositor. The problem
was observed in a debug build on OS X 10.7 (gcc 4.2, openmp disabled, no llvm).
----------------------------------------------------------------------
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
[Switching to process 72386 thread 0xf303]
0x0000000100c129f3 in NodeBase::~NodeBase (this=0x10e501c80) at COM_NodeBase.cpp:43
43 delete (this->m_outputsockets.back());
Current language: auto; currently c++
(gdb) where
#0 0x0000000100c129f3 in NodeBase::~NodeBase (this=0x10e501c80) at COM_NodeBase.cpp:43
#1 0x0000000100c29066 in Node::~Node (this=0x10e501c80) at COM_Node.h:49
#2 0x000000010089c273 in NodeShape::~NodeShape (this=0x10e501c80) at NodeShape.cpp:43
#3 0x000000010089910b in NodeGroup::destroy (this=0x10e501da0) at NodeGroup.cpp:61
#4 0x00000001008990cd in NodeGroup::destroy (this=0x10e5014b0) at NodeGroup.cpp:59
#5 0x00000001008990cd in NodeGroup::destroy (this=0x114e18da0) at NodeGroup.cpp:59
#6 0x00000001007e6602 in Controller::ClearRootNode (this=0x114e19640) at Controller.cpp:329
#7 0x00000001007ea52e in Controller::LoadMesh (this=0x114e19640, re=0x10aba4638, srl=0x1140f5258) at Controller.cpp:302
#8 0x00000001008030ad in prepare (re=0x10aba4638, srl=0x1140f5258) at FRS_freestyle.cpp:302
#9 0x000000010080457a in FRS_do_stroke_rendering (re=0x10aba4638, srl=0x1140f5258) at FRS_freestyle.cpp:600
#10 0x00000001006aeb9d in add_freestyle (re=0x10aba4638) at pipeline.c:1584
#11 0x00000001006aceb7 in do_render_3d (re=0x10aba4638) at pipeline.c:1094
#12 0x00000001006ae061 in do_render_fields_blur_3d (re=0x10aba4638) at pipeline.c:1367
#13 0x00000001006afa16 in do_render_composite_fields_blur_3d (re=0x10aba4638) at pipeline.c:1815
#14 0x00000001006b04e4 in do_render_all_options (re=0x10aba4638) at pipeline.c:2021
----------------------------------------------------------------------
Apparently a name conflict between the two Blender modules is taking place.
The present commit hence intends to address it by putting all the Freestyle C++
classes in the namespace 'Freestyle'. This revision will also prevent potential
name conflicts with other Blender modules in the future.
Special thanks to Lukas Toenne for the help with C++ namespace.
Diffstat (limited to 'source/blender/freestyle/intern/system')
24 files changed, 96 insertions, 4 deletions
diff --git a/source/blender/freestyle/intern/system/BaseIterator.h b/source/blender/freestyle/intern/system/BaseIterator.h index 7b52582d35a..3398f08500c 100644 --- a/source/blender/freestyle/intern/system/BaseIterator.h +++ b/source/blender/freestyle/intern/system/BaseIterator.h @@ -30,6 +30,8 @@ #include <iterator> +namespace Freestyle { + // use for iterators defintions template <class Element> class Nonconst_traits; @@ -87,4 +89,6 @@ protected: IteratorBase() {} }; +} /* namespace Freestyle */ + #endif // BASEITERATOR_H diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h index 1ab967d36f9..c5073527297 100644 --- a/source/blender/freestyle/intern/system/BaseObject.h +++ b/source/blender/freestyle/intern/system/BaseObject.h @@ -31,6 +31,8 @@ #include "FreestyleConfig.h" +namespace Freestyle { + class LIB_SYSTEM_EXPORT BaseObject { public: @@ -67,4 +69,6 @@ private: unsigned _ref_counter; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_BASE_OBJECT_H__ diff --git a/source/blender/freestyle/intern/system/Cast.h b/source/blender/freestyle/intern/system/Cast.h index 0d9bf6bf208..9e115356c0e 100644 --- a/source/blender/freestyle/intern/system/Cast.h +++ b/source/blender/freestyle/intern/system/Cast.h @@ -28,6 +28,8 @@ * \date 01/07/2003 */ +namespace Freestyle { + namespace Cast { template <class T, class U> @@ -39,4 +41,6 @@ namespace Cast } } // end of namespace Cast +} /* namespace Freestyle */ + #endif // __FREESTYLE_CAST_H__ diff --git a/source/blender/freestyle/intern/system/Exception.cpp b/source/blender/freestyle/intern/system/Exception.cpp index cdebd59ef7e..527f57a5bff 100644 --- a/source/blender/freestyle/intern/system/Exception.cpp +++ b/source/blender/freestyle/intern/system/Exception.cpp @@ -27,4 +27,8 @@ #include "Exception.h" +namespace Freestyle { + Exception::exception_type Exception::_exception = Exception::NO_EXCEPTION; + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/Exception.h b/source/blender/freestyle/intern/system/Exception.h index d49e50b66d8..a87c8730c50 100644 --- a/source/blender/freestyle/intern/system/Exception.h +++ b/source/blender/freestyle/intern/system/Exception.h @@ -30,6 +30,8 @@ #include "FreestyleConfig.h" +namespace Freestyle { + class LIB_SYSTEM_EXPORT Exception { public: @@ -60,4 +62,6 @@ private: static exception_type _exception; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_EXCEPTION_H__ diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h index 7759645b718..42f9833836d 100644 --- a/source/blender/freestyle/intern/system/FreestyleConfig.h +++ b/source/blender/freestyle/intern/system/FreestyleConfig.h @@ -34,6 +34,8 @@ using namespace std; +namespace Freestyle { + namespace Config { // Directory separators @@ -86,4 +88,6 @@ namespace Config { } // end of namespace Config +} /* namespace Freestyle */ + #endif // __FREESTYLE_CONFIG_H__ diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h index 4f499bc1d69..641ae41907f 100644 --- a/source/blender/freestyle/intern/system/Id.h +++ b/source/blender/freestyle/intern/system/Id.h @@ -28,6 +28,8 @@ * \date 01/07/2003 */ +namespace Freestyle { + /*! Class used to tag any object by an id. * It is made of two unsigned integers. */ @@ -132,4 +134,6 @@ inline std::ostream& operator<<(std::ostream& s, const Id& id) return s; } +} /* namespace Freestyle */ + # endif // __FREESTYLE_ID_H__ diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h index 92c9a71baa8..2b23a9d7c6a 100644 --- a/source/blender/freestyle/intern/system/Interpreter.h +++ b/source/blender/freestyle/intern/system/Interpreter.h @@ -32,6 +32,8 @@ using namespace std; +namespace Freestyle { + class LIB_SYSTEM_EXPORT Interpreter { public: @@ -55,4 +57,6 @@ protected: string _language; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_INTERPRETER_H__ diff --git a/source/blender/freestyle/intern/system/Iterator.h b/source/blender/freestyle/intern/system/Iterator.h index e2f4c855465..07ea2ae992e 100644 --- a/source/blender/freestyle/intern/system/Iterator.h +++ b/source/blender/freestyle/intern/system/Iterator.h @@ -30,6 +30,8 @@ using namespace std; +namespace Freestyle { + class Iterator { public: @@ -65,4 +67,6 @@ public: } }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_ITERATOR_H__ diff --git a/source/blender/freestyle/intern/system/PointerSequence.h b/source/blender/freestyle/intern/system/PointerSequence.h index c3664b863e4..e551eb6162e 100644 --- a/source/blender/freestyle/intern/system/PointerSequence.h +++ b/source/blender/freestyle/intern/system/PointerSequence.h @@ -61,6 +61,8 @@ #include <algorithm> +namespace Freestyle { + template <typename C, typename T> class PointerSequence : public C { @@ -86,4 +88,6 @@ public: } }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_POINTER_SEQUENCE_H__ diff --git a/source/blender/freestyle/intern/system/Precision.h b/source/blender/freestyle/intern/system/Precision.h index 7b46540aa77..8b859f11444 100644 --- a/source/blender/freestyle/intern/system/Precision.h +++ b/source/blender/freestyle/intern/system/Precision.h @@ -28,10 +28,14 @@ * \date 30/07/2002 */ +namespace Freestyle { + typedef double real; #ifndef SWIG static const real M_EPSILON = 0.00000001; #endif // SWIG +} /* namespace Freestyle */ + #endif // __FREESTYLE_PRECISION_H__ diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h index 54b84e45107..c1ac983a3e8 100644 --- a/source/blender/freestyle/intern/system/ProgressBar.h +++ b/source/blender/freestyle/intern/system/ProgressBar.h @@ -32,6 +32,8 @@ using namespace std; +namespace Freestyle { + class ProgressBar { public: @@ -86,4 +88,6 @@ protected: string _label; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_PROGRESS_BAR_H__ diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index 5e04f56a50c..77b7c565279 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -30,6 +30,8 @@ #include "PseudoNoise.h" #include "RandGen.h" +namespace Freestyle { + static const unsigned NB_VALUE_NOISE = 512; real *PseudoNoise::_values; @@ -107,3 +109,5 @@ real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave) } return y; } + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h index aef3a7bd1f2..b190e8c8568 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.h +++ b/source/blender/freestyle/intern/system/PseudoNoise.h @@ -31,6 +31,8 @@ #include "FreestyleConfig.h" #include "Precision.h" +namespace Freestyle { + class LIB_SYSTEM_EXPORT PseudoNoise { public: @@ -50,4 +52,6 @@ protected: static real *_values; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_PSEUDO_NOISE_H__ diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.cpp b/source/blender/freestyle/intern/system/PythonInterpreter.cpp index 7d2d99a6451..9e7ef39a0e4 100644 --- a/source/blender/freestyle/intern/system/PythonInterpreter.cpp +++ b/source/blender/freestyle/intern/system/PythonInterpreter.cpp @@ -27,5 +27,9 @@ #include "PythonInterpreter.h" +namespace Freestyle { + string PythonInterpreter::_path = ""; bool PythonInterpreter::_initialized = false; + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index 2ceec4c2aa5..c54546b3ddd 100644 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -36,7 +36,6 @@ //soc extern "C" { - #include "MEM_guardedalloc.h" #include "DNA_text_types.h" @@ -49,9 +48,10 @@ extern "C" { #include "BKE_text.h" #include "BPY_extern.h" - } +namespace Freestyle { + class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter { public: @@ -188,4 +188,6 @@ private: static string _path; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_PYTHON_INTERPRETER_H__ diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp index 2be8326ab5c..22727db026b 100644 --- a/source/blender/freestyle/intern/system/RandGen.cpp +++ b/source/blender/freestyle/intern/system/RandGen.cpp @@ -27,6 +27,8 @@ #include "RandGen.h" +namespace Freestyle { + // // Macro definitions // @@ -129,3 +131,5 @@ void RandGen::next() x[1] = LOW(p[1] + r[0]); x[0] = LOW(p[0]); } + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/RandGen.h b/source/blender/freestyle/intern/system/RandGen.h index f6f41042dbe..7d8de72c240 100644 --- a/source/blender/freestyle/intern/system/RandGen.h +++ b/source/blender/freestyle/intern/system/RandGen.h @@ -34,6 +34,8 @@ #include "../system/Precision.h" +namespace Freestyle { + class LIB_SYSTEM_EXPORT RandGen { public: @@ -44,4 +46,6 @@ private: static void next(); }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_RAND_GEN_H__ diff --git a/source/blender/freestyle/intern/system/RenderMonitor.h b/source/blender/freestyle/intern/system/RenderMonitor.h index 47a3b799454..614513b3c56 100644 --- a/source/blender/freestyle/intern/system/RenderMonitor.h +++ b/source/blender/freestyle/intern/system/RenderMonitor.h @@ -29,11 +29,11 @@ */ extern "C" { - #include "render_types.h" - } +namespace Freestyle { + class RenderMonitor { public: @@ -53,4 +53,6 @@ protected: Render *_re; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_RENDER_MONITOR_H__ diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index f7dc1f25071..20cec90fc9f 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -30,6 +30,8 @@ #include "FreestyleConfig.h" #include "StringUtils.h" +namespace Freestyle { + namespace StringUtils { void getPathName(const string& path, const string& base, vector<string>& pathnames) @@ -80,3 +82,5 @@ const char *toAscii(const char *str) } } // end of namespace StringUtils + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h index 21b60720374..983e102d439 100644 --- a/source/blender/freestyle/intern/system/StringUtils.h +++ b/source/blender/freestyle/intern/system/StringUtils.h @@ -47,6 +47,8 @@ extern "C" { using namespace std; +namespace Freestyle { + namespace StringUtils { LIB_SYSTEM_EXPORT @@ -65,4 +67,6 @@ struct ltstr } // end of namespace StringUtils +} /* namespace Freestyle */ + #endif // __FREESTYLE_STRING_UTILS_H__ diff --git a/source/blender/freestyle/intern/system/TimeStamp.cpp b/source/blender/freestyle/intern/system/TimeStamp.cpp index d8f4193fd62..dc4e717486d 100644 --- a/source/blender/freestyle/intern/system/TimeStamp.cpp +++ b/source/blender/freestyle/intern/system/TimeStamp.cpp @@ -27,5 +27,9 @@ #include "TimeStamp.h" +namespace Freestyle { + LIB_SYSTEM_EXPORT TimeStamp *TimeStamp::_instance = 0; + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h index 0a8f0101e6a..2ebfb359dd5 100644 --- a/source/blender/freestyle/intern/system/TimeStamp.h +++ b/source/blender/freestyle/intern/system/TimeStamp.h @@ -30,6 +30,8 @@ #include "FreestyleConfig.h" +namespace Freestyle { + class LIB_SYSTEM_EXPORT TimeStamp { public: @@ -68,4 +70,6 @@ private: unsigned _time_stamp; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_TIME_STAMP_H__ diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h index 26b9180f6d2..a769eb5b649 100644 --- a/source/blender/freestyle/intern/system/TimeUtils.h +++ b/source/blender/freestyle/intern/system/TimeUtils.h @@ -32,6 +32,8 @@ #include "FreestyleConfig.h" +namespace Freestyle { + class Chronometer { public: @@ -54,4 +56,6 @@ private: clock_t _start; }; +} /* namespace Freestyle */ + #endif // __FREESTYLE_TIME_UTILS_H__ |