Fix: Do not return transient string in PyTypeManager.
* Bug: In Isobar3::PyTypeManager, the accessors _getCppTypeName() and _getPyTypeName() where returning string *by value*, hence, short lived copies. But, in _setupPyType() and _addToModule(), as we interface with the Python/C API, we extract the c_str(). Which where removed as we used temporary objects. Leading to memory corruption and weird crashes. Now returns "const string&" so the c_str() stays allocated.
This commit is contained in:
parent
9aaaf33e6e
commit
0c54d109cc
|
@ -212,8 +212,8 @@ extern "C" {
|
|||
public:
|
||||
inline bool _isDBo () const;
|
||||
inline bool _isIterator () const;
|
||||
inline std::string _getCppTypeName () const;
|
||||
inline std::string _getPyTypeName () const;
|
||||
inline const std::string& _getCppTypeName () const;
|
||||
inline const std::string& _getPyTypeName () const;
|
||||
inline std::string _getTypeInfo () const;
|
||||
inline PyTypeObject* _getTypeObject ();
|
||||
inline PyMethodDef* _getMethods ();
|
||||
|
@ -330,8 +330,8 @@ extern "C" {
|
|||
|
||||
inline bool PyTypeManager::_isDBo () const { return _flags & IsDBo; }
|
||||
inline bool PyTypeManager::_isIterator () const { return _flags & IsIterator; }
|
||||
inline std::string PyTypeManager::_getCppTypeName () const { return _cppTypeName; }
|
||||
inline std::string PyTypeManager::_getPyTypeName () const { return _pyTypeName; }
|
||||
inline const std::string& PyTypeManager::_getCppTypeName () const { return _cppTypeName; }
|
||||
inline const std::string& PyTypeManager::_getPyTypeName () const { return _pyTypeName; }
|
||||
inline PyTypeObject* PyTypeManager::_getTypeObject () { return &_typeObject; }
|
||||
inline PyMethodDef* PyTypeManager::_getMethods () { return _methods; }
|
||||
inline PyGetSetDef* PyTypeManager::_getGetsets () { return _getsets; }
|
||||
|
|
Loading…
Reference in New Issue