Skip to content

Commit

Permalink
fix #16849: Set ownership of PopupView::m_contentItem
Browse files Browse the repository at this point in the history
Items created in QML are managed by the QML engine, so they can't be deleted from C++ code. The destructor of PopupView deletes the object and it should delete only objects with Cpp ownership.
  • Loading branch information
adazem009 committed Jun 15, 2023
1 parent d6ace8b commit 887ddb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/framework/uicomponents/view/popupview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ PopupView::~PopupView()
if (m_window) {
m_window->setOnHidden(std::function<void()>());
}
m_contentItem->deleteLater();

if (QQmlEngine::objectOwnership(m_contentItem) == QQmlEngine::CppOwnership) {
m_contentItem->deleteLater();
}

if (m_closeController) {
delete m_closeController;
Expand Down

0 comments on commit 887ddb6

Please sign in to comment.