Prevent sparse output connector list from causing disowned events

This commit is contained in:
Vftdan 2024-08-19 21:12:12 +02:00
parent 91ec8ef423
commit 0967e9eb85
6 changed files with 30 additions and 1 deletions

View File

@ -35,6 +35,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase; event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase;
if (!event->position) {
EventNode *orphaned = event;
event = orphaned->prev;
event_destroy(orphaned);
}
event = event->next; event = event->next;
} }
return true; return true;

View File

@ -25,6 +25,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase; event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase;
if (!event->position) {
EventNode *orphaned = event;
event = orphaned->prev;
event_destroy(orphaned);
}
event = event->next; event = event->next;
} }
return true; return true;

View File

@ -22,6 +22,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase; event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase;
if (!event->position) {
EventNode *orphaned = event;
event = orphaned->prev;
event_destroy(orphaned);
}
event = event->next; event = event->next;
} }
return true; return true;

View File

@ -17,7 +17,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
if (event_predicate_apply(node->predicates[i], event) == EVPREDRES_ACCEPTED) { if (event_predicate_apply(node->predicates[i], event) == EVPREDRES_ACCEPTED) {
if (event_replicate(event, 1)) { if (event_replicate(event, 1)) {
event->next->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase; EventNode * replica = event->next;
replica->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase;
if (!replica->position) {
event_destroy(replica);
}
} }
} }
} }

View File

@ -39,6 +39,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase; event->position = &node->as_GraphNode.outputs.elements[i]->as_EventPositionBase;
if (!event->position) {
EventNode *orphaned = event;
event = orphaned->prev;
event_destroy(orphaned);
}
event = event->next; event = event->next;
} }
return true; return true;

View File

@ -15,6 +15,11 @@ handle_event(EventPositionBase * self, EventNode * event)
} }
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
event->position = &node->outputs.elements[i]->as_EventPositionBase; event->position = &node->outputs.elements[i]->as_EventPositionBase;
if (!event->position) {
EventNode *orphaned = event;
event = orphaned->prev;
event_destroy(orphaned);
}
event = event->next; event = event->next;
} }
return true; return true;