From 6fd6df90c8b2e151c5d67cfbac2bf28592772deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 14 Jan 2026 23:40:03 -0500 Subject: [PATCH] feat(framework): add overridable hooks to `TUWidgetLayoutViewBase` - `onParentDisconnect` -> called after the containing widget is destroyed and disconnected from its parent - `afterWidgetCreated` -> called after the view's widget is (re)created --- framework/include/public/toon_boom/ext/layout.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/include/public/toon_boom/ext/layout.hpp b/framework/include/public/toon_boom/ext/layout.hpp index 6d55b3b..4c5fb2e 100644 --- a/framework/include/public/toon_boom/ext/layout.hpp +++ b/framework/include/public/toon_boom/ext/layout.hpp @@ -61,13 +61,16 @@ public: protected: QPointer m_widget; QWidget *m_parentConnected; // Track which parent we've connected to + virtual void onParentDisconnect() {} + virtual void afterWidgetCreated() {} + void ensureWidget() { if (!m_widget) { m_widget = createWidget(); - m_widget->setAttribute(Qt::WA_DeleteOnClose, false); - m_widget->setAttribute(Qt::WA_QuitOnClose, false); + afterWidgetCreated(); } } + // Connect to the widget's current parent to unparent before deletion // This prevents cross-DLL heap corruption when Qt tries to delete our widget void connectToParentIfNeeded() {