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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2015-10-28 17:09:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-10-29 13:10:17 +0300
commit424ea476b1bbb18bce64dd942c17d2a5e5f238d5 (patch)
treec1a08bbe8b37e698559328310e9a1b05a223aa16
parent1823e5662543c07292712de0cf781b34eb109ac3 (diff)
Fix T44231: Freestyle causes crash on render.
The reported crash was confirmed as a segmentation fault in std::sort(). The cause of the crash was traced down to a binary comparison function that was not satisfying the so-called strict weak ordering requirements of the C++ standard sorting function. Specifically, the comparison operator has to return false when two objects are equivalent (i.e., comp(a, a) must be false), but that requirement was not met. Since the binary comparison operator in question could be a user-defined Python function, here a safety measure is implemented in the C++ layer to make sure the aforementioned requirement is always satisfied.
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index 87ba34e8f42..dfb50d903f7 100644
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -996,6 +996,8 @@ public:
inline bool operator()(Interface1D *i1, Interface1D *i2)
{
+ if (i1 == i2)
+ return false;
if ((*_pred)(*i1, *i2) < 0)
throw std::runtime_error("comparison failed");
return _pred->result;