-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault when calling Julia functions #183
Comments
libjlqml
?
I get the same segfault when running the code example at the julia> using QML
julia> greet() = "Hello, World!";
julia> @qmlfunction greet
julia> mktempdir() do folder
path = joinpath(folder, "main.qml")
write(path, """
import org.julialang
import QtQuick
import QtQuick.Controls
ApplicationWindow {
visible: true
Text {
text: Julia.greet()
}
Timer {
running: true; repeat: false
onTriggered: Qt.exit(0)
}
}
""")
loadqml(path)
exec()
end |
This just got a bit weirder. I realised that the above statement is not strictly true. As long as I call The error seems to be in this function in |
Working through the code of s_singletonInstance->set_js_engine(qmlEngine); Shouldn't this pass |
Thanks for reporting this and looking into it. The reason is that after |
Wonderful, thank you for addressing this so quickly! However, I don't yet understand how this affects my original problem. Why do I get this segfault straight away when running my own code? This is the file in question (redacted, but structurally unchanged): global model = missing
const running = Observable(false)
const date = Observable(today())
const progress = Observable(0.0)
const delay = Observable(0.5)
const runbuttontext = Observable(">>")
const runbuttontip = Observable("Run")
function newsimulation()
# do some stuff
println("Model initialised.")
end
function nextstep()
# do some stuff
println("Updated model.")
end
function runsimulation()
# do some stuff
end
function togglerunning()
if running[]
running[] = false
runbuttontext[] = ">>"
runbuttontip[] = "Run"
else
running[] = true
runbuttontext[] = "||"
runbuttontip[] = "Pause"
runsimulation()
end
end
function render_map(screen)
# do some stuff
end
@qmlfunction newsimulation
@qmlfunction nextstep
@qmlfunction togglerunning
@qmlfunction render_map
on(delay) do d
println("Delay is now $(round(d, digits=1)) seconds.")
end
on(running) do r
r ? println("Simulation started.") : println("Simulation stopped.")
end
"""
launch()
The main function that creates the application.
"""
function launch()
qmlfile = joinpath(dirname(@__FILE__), "main.qml")
loadqml(qmlfile,
vars = JuliaPropertyMap("running" => running,
"date" => date,
"delay" => delay,
"progress" => progress,
"runbuttontext" => runbuttontext,
"runbuttontip" => runbuttontip))
println("Launched program.")
exec()
end When I load my package and run |
Fix for issue JuliaGraphics/QML.jl#183
Fix for issue JuliaGraphics/QML.jl#183
Fixed in QML.jl 0.8.1, with documentation here: https://juliagraphics.github.io/QML.jl/dev/#Using-QML.jl-inside-another-Julia-module |
Is this still an issue with QML 0.8.1? |
No. Bart and I had a short video conference yesterday and it works now 🙂 One problem had been that I was calling |
When my QML window calls a function that was defined in Julia and tagged using
@qmlfunction
, I get a segfault:It seems thatEdit: I manually installedlibjlqml
is not installed - how can I do so?jlqml_jll
0.5.3, but the error persists.I'm using QML.jl 0.8 with Qt6Base_jll 6.5.2 and CxxWrap 0.14.0 on Julia 1.9.3. Is there any other dependency I need?
The text was updated successfully, but these errors were encountered: