diff --git a/src/declarativeimports/core/corebindingsplugin.cpp b/src/declarativeimports/core/corebindingsplugin.cpp index c03b08ebb..daedccc09 100644 --- a/src/declarativeimports/core/corebindingsplugin.cpp +++ b/src/declarativeimports/core/corebindingsplugin.cpp @@ -74,7 +74,10 @@ void CoreBindingsPlugin::registerTypes(const char *uri) Q_ASSERT(uri == QByteArray("org.kde.plasma.core")); qmlRegisterUncreatableType(uri, 2, 0, "Types", {}); - qmlRegisterSingletonType(uri, 2, 0, "Units", [](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); }); + qmlRegisterSingletonType(uri, 2, 0, "Units", [](QQmlEngine *engine, QJSEngine*) -> QObject* { + engine->setObjectOwnership(&Units::instance(), QQmlEngine::CppOwnership); + return &Units::instance(); + }); qmlRegisterType(uri, 2, 0, "Svg"); qmlRegisterType(uri, 2, 0, "FrameSvg");