Fix #109676: GPU compositor crashes on muting output nodes
The Realtime GPU compositor crashes when muting output or viewer nodes. This happens because output nodes are scheduled regardless of their muted statued, however, the initial reference count takes the muted status into account, resulting in a use after free error, hence the crash. To fix this, we simply do not schedule muted output nodes.
This commit is contained in:
@@ -28,14 +28,14 @@ using namespace nodes::derived_node_tree_types;
|
||||
static bool add_viewer_nodes_in_context(const DTreeContext *context, Stack<DNode> &node_stack)
|
||||
{
|
||||
for (const bNode *node : context->btree().nodes_by_type("CompositorNodeViewer")) {
|
||||
if (node->flag & NODE_DO_OUTPUT) {
|
||||
if (node->flag & NODE_DO_OUTPUT && !(node->flag & NODE_MUTED)) {
|
||||
node_stack.push(DNode(context, node));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const bNode *node : context->btree().nodes_by_type("CompositorNodeSplitViewer")) {
|
||||
if (node->flag & NODE_DO_OUTPUT) {
|
||||
if (node->flag & NODE_DO_OUTPUT && !(node->flag & NODE_MUTED)) {
|
||||
node_stack.push(DNode(context, node));
|
||||
return true;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ static bool add_viewer_nodes_in_context(const DTreeContext *context, Stack<DNode
|
||||
/* No active viewers exist in this context, try to add the Composite node as a fallback viewer if
|
||||
* it was not already added. */
|
||||
for (const bNode *node : context->btree().nodes_by_type("CompositorNodeComposite")) {
|
||||
if (node->flag & NODE_DO_OUTPUT) {
|
||||
if (node->flag & NODE_DO_OUTPUT && !(node->flag & NODE_MUTED)) {
|
||||
node_stack.push(DNode(context, node));
|
||||
return true;
|
||||
}
|
||||
@@ -73,7 +73,9 @@ static void add_output_nodes(const Context &context,
|
||||
/* Only add File Output nodes if the context supports them. */
|
||||
if (context.use_file_output()) {
|
||||
for (const bNode *node : root_context.btree().nodes_by_type("CompositorNodeOutputFile")) {
|
||||
node_stack.push(DNode(&root_context, node));
|
||||
if (!(node->flag & NODE_MUTED)) {
|
||||
node_stack.push(DNode(&root_context, node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +83,7 @@ static void add_output_nodes(const Context &context,
|
||||
* Composite node may still be added as a fallback viewer output below. */
|
||||
if (context.use_composite_output()) {
|
||||
for (const bNode *node : root_context.btree().nodes_by_type("CompositorNodeComposite")) {
|
||||
if (node->flag & NODE_DO_OUTPUT) {
|
||||
if (node->flag & NODE_DO_OUTPUT && !(node->flag & NODE_MUTED)) {
|
||||
node_stack.push(DNode(&root_context, node));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user