qtquick: Fix crash when dereferencing incomplete stack controler

The stack controller CTOR was still in the stack (pun intended), then
dereferenced by tabbar. Instead, call Stack_qtquick::init() to intitialize
the the TabBar. At this point the Stack controller is already usable.
This commit is contained in:
Sergio Martins
2022-06-04 21:30:43 +01:00
parent ec144472ce
commit 56ca80e8fc
2 changed files with 19 additions and 3 deletions

View File

@@ -26,7 +26,6 @@ Stack_qtquick::Stack_qtquick(Controllers::Stack *controller,
Controllers::Frame *parent)
: View_qtquick(controller, Type::Stack, Views::asQQuickItem(parent))
, m_dockWidgetModel(new DockWidgetModel(this))
, m_tabBar(new Controllers::TabBar(controller))
, m_stack(controller)
{
connect(m_dockWidgetModel, &DockWidgetModel::countChanged, this,
@@ -40,6 +39,17 @@ Stack_qtquick::Stack_qtquick(Controllers::Stack *controller,
Q_EMIT countChanged(); });
}
void Stack_qtquick::init()
{
m_tabBar = new Controllers::TabBar(m_stack);
Q_EMIT tabBarChanged();
}
Controllers::Stack *Stack_qtquick::stack() const
{
return m_stack;
}
void Stack_qtquick::setDocumentMode(bool)
{
qDebug() << "Not implemented";