Skip to content

Commit 3409b27

Browse files
committed
Keep Julia ownership when setting values in a JuliaPropertyMap
Fixes Segfault when exiting Julia after replacing a JuliaItemModel #218
1 parent 7a3c4f7 commit 3409b27

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "QML"
22
uuid = "2db162a6-7e43-52c3-8d84-290c1c42d82a"
3-
version = "0.13.1"
3+
version = "0.13.2"
44
authors = ["Bart Janssens <bart@bartjanssens.org>"]
55

66
[deps]
@@ -30,7 +30,7 @@ MacroTools = "0.5"
3030
Observables = "0.5"
3131
Qt6Svg_jll = "6.10"
3232
Qt6Wayland_jll = "6.10"
33-
jlqml_jll = "0.10.2"
33+
jlqml_jll = "0.10.3"
3434
julia = "1.10"
3535

3636
[extras]

src/QML.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ end
330330
# QQmlPropertyMap indexing interface
331331
Base.getindex(propmap::QQmlPropertyMap, key::AbstractString) = value(value(propmap, key))
332332
Base.setindex!(propmap::QQmlPropertyMap, val, key::AbstractString) = insert(propmap, QString(key), QVariant(val))
333+
function Base.setindex!(propmap::QQmlPropertyMap, val::QObject, key::AbstractString)
334+
insert(propmap, QString(key), QVariant(val))
335+
setObjectOwnership(CxxPtr(val), CppOwnership)
336+
end
333337
Base.setindex!(propmap::QQmlPropertyMap, val::QVariant, key::AbstractString) = insert(propmap, key, val)
334338
Base.setindex!(propmap::QQmlPropertyMap, val::Irrational, key::AbstractString) = (propmap[key] = convert(Float64, val))
335339

0 commit comments

Comments
 (0)