From e055438f30ae04fb2903030cbc5f8093cd6f0727 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Sun, 4 Oct 2026 14:59:10 +1300 Subject: [PATCH] Fix a crash when cross-reference settings change after a text group is deleted A text group kept at the bottom of the page, on a master element, connects to its project's XRefPropertiesChanged with a lambda that has no context object. The connection belongs to the project, so it outlives the group: once the group is deleted (paste a coil, undo, then make any other edit), changing a cross-reference setting in the project properties calls QTimer::singleShot() on the freed group and QElectroTech crashes. Pass the group as the context of that connection and of the linkedElementChanged one beside it, so Qt removes both when the group goes. Co-Authored-By: Claude Opus 5.5 --- sources/qetgraphicsitem/elementtextitemgroup.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index 8c89e7c50..86f6cd054 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -364,9 +364,12 @@ void ElementTextItemGroup::setHoldToBottomPage(bool hold) // before updating the position of this group //because the position of this group is related // to the size of the parent element Xref + //this is the context of both connections, so they go + //when the group is deleted: the project outlives it. m_linked_changed_timer = connect( m_parent_element, &Element::linkedElementChanged, + this, [this]() {QTimer::singleShot(200, this, @@ -376,6 +379,7 @@ void ElementTextItemGroup::setHoldToBottomPage(bool hold) m_XrefChanged_timer = connect( m_parent_element->diagram()->project(), &QETProject::XRefPropertiesChanged, + this, [this]() {QTimer::singleShot(200, this,