Page MenuHome

Blender crashes with Rendered 3d view use of freestyle
Closed, ResolvedPublic


System Information
Debian (jessie) x64.

Blender Version

Worked: n/a

A particular Freestyle use causes segfault

Exact steps for others to reproduce the error
Load attached .blend. Switch upper right view to Rendered view. Crashes on my system and Olson's.

Related Objects

Event Timeline

Jaggz H (jaggz) raised the priority of this task from to 90.
Jaggz H (jaggz) updated the task description. (Show Details)
Jaggz H (jaggz) added a project: BF Blender.
Jaggz H (jaggz) edited a custom field.
Jaggz H (jaggz) added a subscriber: Jaggz H (jaggz).

Confirmed the crash,

This looks like a missing NULL check, and this patch stops the crash: P276

However after its applied, a Python exception is raised:

read blend: /d/test(6).blend
expected cost = 3.924107 (4)
Traceback (most recent call last):
  File "/d/test(6).blend/", line 32, in <module>
RuntimeError: Operators.bidirectional_chain() failed

location: <unknown location>:-1

location: <unknown location>:-1

Error executing Python script from PythonInterpreter::interpretText
Error: Traceback (most recent call last):
  File "/d/test(6).blend/", line 32, in <module>
RuntimeError: Operators.bidirectional_chain() failed

@Tamito Kajiyama (kjym3), would you be able to look into this for 2.76a bugfix release?

Campbell Barton (campbellbarton) lowered the priority of this task from 90 to 50.Oct 26 2015, 7:24 AM

Thank you Campbell for the proposed fix.

Short summary of the problem and expected behavior after the fix: There is a coding error at line 32 of the user program (in the Text Editor in the provided .blend file). After the fix the rendering should raise a Python exception at run time.

Long explanation behind the short summary:

The freestyle.chainingiterator.ChainPredicateIterator class is usually instantiated with two predicate objects supplied as the first two arguments. The problem was that it was possible to instantiate the class without predicates, and there were missing NULL checks as identified by Campbell.

There were two possible solutions. One solution was to permit the instantiation of the ChainPredicateIterator class as it was and let it run without run-time errors. The other (i.e., present) solution is not to permit the class instantiation without predicates in the first place. Allowing the instantiation without predicates while raising errors at run time does not make sense to me, so it was not considered as a solution here.

Then the question was which of the two possibilities would be preferable as a proposed solution. The most straightforward choice to me was the latter solution, because the ChainPredicateIterator is specifically intended to work with predicates. As a matter of fact, the idea of permitting the class instantiation without predicates came from the original authors of Freestyle much before its integration into Blender. The only reasonable expected behavior of the ChainPredicateIterator without predicates is to do nothing. That is, it provides users with a way to define a no-op chaining iterator. But the Freestyle Python API reference manual indicates that the class constructor takes four optional parameters even when no predicate objects are supplied as arguments. What is the point of having optional parameters when the class instance is supposed to be a no-op operator? That does not make much sense to me.

So, my decision (on the API design actually) is not to allow the ChainPredicateIterator class to be instantiated without predicates. This implies that the user-defined Freestyle Python module in the provided .blend file now contains an API violation that needs to be fixed on the user side.

The proposed solution contains a backward-incompatible API change, but it should rather be considered as a fix of an API bug.