diff --git a/Cargo.toml b/Cargo.toml index f6c2af8..c7f5c61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ki18n" description = "A crate to use KF5I18n from rust." author = ["Ayush Singh "] -version = "1.1.1" +version = "2.0.0" edition = "2021" links = "KF5I18n" license = "MIT" diff --git a/src/klocalizedcontext.rs b/src/klocalizedcontext.rs index 77ac9c2..3aaa8f0 100644 --- a/src/klocalizedcontext.rs +++ b/src/klocalizedcontext.rs @@ -38,9 +38,8 @@ impl KLocalizedContext { pub fn init_from_engine(engine: &QmlEngine) -> Self { let engine_ptr = engine.cpp_ptr(); cpp!(unsafe [engine_ptr as "QQmlEngine*"] -> KLocalizedContext as "KLocalizedContextHolder" { - auto klocalized = new KLocalizedContext(engine_ptr); - auto klocalizedholder = KLocalizedContextHolder(klocalized); - engine_ptr->rootContext()->setContextObject(klocalized); + auto klocalizedholder = KLocalizedContextHolder(engine_ptr); + engine_ptr->rootContext()->setContextObject(klocalizedholder.klocalized.get()); return klocalizedholder; }) }