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() {