[Bf-blender-cvs] [7ee9de2] master: Fix T38487: Wrapped translate node in combination with other buffered nodes (Blur) causes crash due to chained read/write buffer operations.

Lukas Tönne noreply at git.blender.org
Mon Feb 17 10:58:50 CET 2014


Commit: 7ee9de29a623cfb2a1efa70eb93e5b18bb8ed144
Author: Lukas Tönne
Date:   Mon Feb 17 10:48:54 2014 +0100
https://developer.blender.org/rB7ee9de29a623cfb2a1efa70eb93e5b18bb8ed144

Fix T38487: Wrapped translate node in combination with other buffered
nodes (Blur) causes crash due to chained read/write buffer operations.

The way read/write buffer operations are created for both the wrapped
translate node and then the "complex" blur node creates a chain of
buffers in the same ExecutionGroup. This leaves the later write buffer
operations without a proper "executor" group and fails on assert.

Solution for now is to check for existing output buffer operations like
it already happens for inputs. This is extremely ugly code, but should
become a lot more transparent after compositor cleanup ({D309}).

===================================================================

M	source/blender/compositor/intern/COM_ExecutionSystem.cpp

===================================================================

diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 6a20800..0882324 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -241,14 +241,34 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
 	 */
 	OutputSocket *outputsocket = operation->getOutputSocket();
 	if (outputsocket->isConnected()) {
-		WriteBufferOperation *writeOperation;
-		writeOperation = new WriteBufferOperation();
-		writeOperation->setbNodeTree(this->getContext().getbNodeTree());
-		this->addOperation(writeOperation);
-		ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
+		WriteBufferOperation *writeOperation = NULL;
+		/* try to find existing write buffer operation first */
+		for (index = 0; index < outputsocket->getNumberOfConnections(); index++) {
+			SocketConnection *connection = outputsocket->getConnection(index);
+			NodeBase *otherEnd = connection->getToNode();
+			if (otherEnd->isOperation()) {
+				NodeOperation *otherEndOp = (NodeOperation *)otherEnd;
+				if (otherEndOp->isWriteBufferOperation()) {
+					writeOperation = (WriteBufferOperation *)otherEndOp;
+					break;
+				}
+			}
+		}
+		/* if no write buffer operation exists yet, create a new one */
+		if (!writeOperation) {
+			writeOperation = new WriteBufferOperation();
+			writeOperation->setbNodeTree(this->getContext().getbNodeTree());
+			this->addOperation(writeOperation);
+			ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
+		}
 		writeOperation->readResolutionFromInputSocket();
-		for (index = 0; index < outputsocket->getNumberOfConnections() - 1; index++) {
+		
+		for (index = 0; index < outputsocket->getNumberOfConnections(); index++) {
 			SocketConnection *connection = outputsocket->getConnection(index);
+			/* skip existing connections to write buffer operation */
+			if (connection->getToNode() == writeOperation)
+				continue;
+			
 			ReadBufferOperation *readoperation = new ReadBufferOperation();
 			readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
 			connection->setFromSocket(readoperation->getOutputSocket());




More information about the Bf-blender-cvs mailing list