Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-04 19:35:07 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-01-04 19:58:55 +0300
commitbd5394f6c0bec4eb969aa8bd24b072d7dd9ab04d (patch)
treede12a648b59fa06625a8206d1471c7f765aa2949
parent0d736d689671c4c28a8bda6ca1f8ab61726142b5 (diff)
Fix T57890: freestyle rendering crash.
Depsgraph objects are deleted after conversion to Freestyle data structures, so don't keep a pointer to their name strings.
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp7
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.h18
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.h14
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h4
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.h14
7 files changed, 28 insertions, 33 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index a42e59ddb2a..176193bc65a 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -733,7 +733,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
// sets the id of the rep
rep->setId(Id(id, 0));
rep->setName(ob->id.name + 2);
- rep->setLibraryPath(ob->id.lib ? ob->id.lib->name : NULL);
+ rep->setLibraryPath(ob->id.lib ? ob->id.lib->name : "");
const BBox<Vec3r> bbox = BBox<Vec3r>(Vec3r(ls.minBBox[0], ls.minBBox[1], ls.minBBox[2]),
Vec3r(ls.maxBBox[0], ls.maxBBox[1], ls.maxBBox[2]));
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index 28c9e815196..00a1f5ce34d 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -185,7 +185,7 @@ PyDoc_STRVAR(SShape_name_doc,
static PyObject *SShape_name_get(BPy_SShape *self, void *UNUSED(closure))
{
- return PyUnicode_FromString(self->ss->getName());
+ return PyUnicode_FromString(self->ss->getName().c_str());
}
static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index 33c18c3ce80..f3f8fc616fd 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -293,7 +293,7 @@ PyDoc_STRVAR(ViewShape_name_doc,
static PyObject *ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure))
{
- return PyUnicode_FromString(self->vs->getName());
+ return PyUnicode_FromString(self->vs->getName().c_str());
}
PyDoc_STRVAR(ViewShape_library_path_doc,
@@ -303,10 +303,7 @@ PyDoc_STRVAR(ViewShape_library_path_doc,
static PyObject *ViewShape_library_path_get(BPy_ViewShape *self, void *UNUSED(closure))
{
- const char *name = self->vs->getLibraryPath();
- if (!name)
- Py_RETURN_NONE;
- return PyUnicode_FromString(name);
+ return PyUnicode_FromString(self->vs->getLibraryPath().c_str());
}
PyDoc_STRVAR(ViewShape_id_doc,
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index 4c8017e162d..222653b2433 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -28,6 +28,8 @@
* \date 25/01/2002
*/
+#include <string>
+
#include "FrsMaterial.h"
#include "SceneVisitor.h"
@@ -38,6 +40,8 @@
#include "../system/Id.h"
#include "../system/Precision.h"
+using namespace std;
+
namespace Freestyle {
using namespace Geometry;
@@ -48,8 +52,6 @@ public:
inline Rep() : BaseObject()
{
_Id = 0;
- _Name = 0;
- _LibraryPath = 0;
_FrsMaterial = 0;
}
@@ -132,12 +134,12 @@ public:
return _Id;
}
- inline const char *getName() const
+ inline const string& getName() const
{
return _Name;
}
- inline const char *getLibraryPath() const
+ inline const string& getLibraryPath() const
{
return _LibraryPath;
}
@@ -158,12 +160,12 @@ public:
_Id = id;
}
- inline void setName(const char *name)
+ inline void setName(const string& name)
{
_Name = name;
}
- inline void setLibraryPath(const char *path)
+ inline void setLibraryPath(const string& path)
{
_LibraryPath = path;
}
@@ -176,8 +178,8 @@ public:
private:
BBox<Vec3f> _BBox;
Id _Id;
- const char *_Name;
- const char *_LibraryPath;
+ string _Name;
+ string _LibraryPath;
FrsMaterial *_FrsMaterial;
};
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index a18cf41797b..4276409190e 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -1415,8 +1415,8 @@ private:
vector<SVertex*> _verticesList; // list of all vertices
vector<FEdge*> _edgesList; // list of all edges
Id _Id;
- const char *_Name;
- const char *_LibraryPath;
+ string _Name;
+ string _LibraryPath;
BBox<Vec3r> _BBox;
vector<FrsMaterial> _FrsMaterials;
@@ -1436,8 +1436,6 @@ public:
userdata = NULL;
_importance = 0.0f;
_ViewShape = NULL;
- _Name = NULL;
- _LibraryPath = NULL;
}
/*! Copy constructor */
@@ -1891,13 +1889,13 @@ public:
}
/*! Returns the name of the Shape. */
- inline const char *getName() const
+ inline const string& getName() const
{
return _Name;
}
/*! Returns the library path of the Shape. */
- inline const char *getLibraryPath() const
+ inline const string& getLibraryPath() const
{
return _LibraryPath;
}
@@ -1910,13 +1908,13 @@ public:
}
/*! Sets the name of the shape.*/
- inline void setName(const char *name)
+ inline void setName(const string& name)
{
_Name = name;
}
/*! Sets the library path of the shape.*/
- inline void setLibraryPath(const char *path)
+ inline void setLibraryPath(const string& path)
{
_LibraryPath = path;
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 0acc6ca39d8..87b59dc1b54 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -1566,13 +1566,13 @@ public:
}
/*! Returns the ViewShape name. */
- inline const char *getName() const
+ inline const string& getName() const
{
return _SShape->getName();
}
/*! Returns the ViewShape library path. */
- inline const char *getLibraryPath() const
+ inline const string& getLibraryPath() const
{
return _SShape->getLibraryPath();
}
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 30f55ff7e73..7efed908d73 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -1024,8 +1024,8 @@ protected:
vector<WEdge *> _EdgeList;
vector<WFace *> _FaceList;
int _Id;
- const char *_Name;
- const char *_LibraryPath;
+ string _Name;
+ string _LibraryPath;
static unsigned _SceneCurrentId;
#if 0
Vec3f _min;
@@ -1044,8 +1044,6 @@ public:
#endif
_Id = _SceneCurrentId;
_SceneCurrentId++;
- _Name = 0;
- _LibraryPath = 0;
}
/*! copy constructor */
@@ -1125,12 +1123,12 @@ public:
}
#endif
- inline const char *getName() const
+ inline const string& getName() const
{
return _Name;
}
- inline const char *getLibraryPath() const
+ inline const string& getLibraryPath() const
{
return _LibraryPath;
}
@@ -1179,12 +1177,12 @@ public:
_FrsMaterials = iMaterials;
}
- inline void setName(const char *name)
+ inline void setName(const string& name)
{
_Name = name;
}
- inline void setLibraryPath(const char *path)
+ inline void setLibraryPath(const string& path)
{
_LibraryPath = path;
}