Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

fix for julia v1.5; jl_function_ptr was removed #512

Merged
merged 1 commit into from
Jun 4, 2020
Merged

Conversation

JeffBezanson
Copy link
Contributor

This seems to work well enough for now as a workaround; ImageView.jl works at least. Would be good to try some more Gtk apps to confirm whether it works. I wanted to to just un-break 1.5, and we can work on a redesign later.

src/events.jl Outdated Show resolved Hide resolved
src/events.jl Outdated
else
ret = ccall(closure.callback, Cint, (Ptr{GObject}, Ptr{GdkEventMotion}, Any), p, eventp, closure.closure)
end
ret = closure.callback.f(p, eventp, closure.closure)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ret = closure.callback.f(p, eventp, closure.closure)
ret = closure.callback(p, eventp, closure.closure)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be preferable to avoid increasing yet more the dependence on internal design details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I don't think we have a call overload for CFunction though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but let's just not allocate it then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait a minute, is this only called from julia? Why was it using cfunction in the first place? @tknopp any reason?

@timholy
Copy link
Member

timholy commented Jun 3, 2020

With ProfileView I get a long inference stacktrace from @JeffBezanson's version, and with @vtjnash's I get

julia> FATAL ERROR: Gtk state corrupted by error thrown in a callback:
ERROR: MethodError: objects of type Base.CFunction are not callable
Stacktrace:
 [1] notify_motion(::Ptr{GObject}, ::Ptr{Gtk.GdkEventMotion}, ::Gtk.Gtk_signal_motion{GtkReactive.MouseHandler{GtkReactive.UserUnit}}) at /home/tim/.julia/dev/Gtk/src/events.jl:46
 [2] (::Gtk.var"#237#238")() at /home/tim/.julia/dev/Gtk/src/events.jl:2
 [3] g_sigatom(::Any) at /home/tim/.julia/dev/Gtk/src/GLib/signals.jl:176
 [4] gtk_main() at /home/tim/.julia/dev/Gtk/src/events.jl:1

@JeffBezanson
Copy link
Contributor Author

Looking into it.

@JeffBezanson
Copy link
Contributor Author

Works on 1.5 --- the inference issue is due to a recent change on master.

@tknopp
Copy link
Collaborator

tknopp commented Jun 4, 2020

Thanks a lot for having a look into this. Especially nice is that we do not need to change the public interface. Would be interesting how "bad" you would consider this workaround. As far a I can see you are using a generated function to move the call to @function into an earlier stage of the compiler. I know that generated functions should not be used too much, but in my opinion we currently only have a hand full calls to the native signal_connect function.

@JeffBezanson
Copy link
Contributor Author

I don't think it's that bad. Certainly better than calling an internal C function, so for purposes of keeping the current API it's fine.

@timholy
Copy link
Member

timholy commented Jun 4, 2020

Do you want this merged as-is or do you want #512 (comment) and/or other changes?

@giordano
Copy link
Contributor

giordano commented Jun 4, 2020

Note that arm64 is failing on Drone because tests that were broken aren't anymore:

SetCoordinates: Error During Test at /drone/src/test/gui.jl:548
 Unexpected Pass
 Expression: mtrx.xx == 300
 Got correct result, please change to @test if no longer broken.

SetCoordinates: Error During Test at /drone/src/test/gui.jl:549
 Unexpected Pass
 Expression: mtrx.yy == 280
 Got correct result, please change to @test if no longer broken.

armv7l is failing at init time instead:

Stacktrace:
 [1] pipeline_error at ./process.jl:525 [inlined]
 [2] read(::Cmd) at ./process.jl:412
 [3] (::Gtk.var"#301#307"{String})() at /drone/src/src/Gtk.jl:94
 [4] withenv(::Gtk.var"#301#307"{String}, ::Pair{String,String}) at ./env.jl:161
 [5] (::Gtk.var"#300#306")(::String) at /drone/src/src/Gtk.jl:93
 [6] (::gdk_pixbuf_jll.var"#8#9"{Gtk.var"#300#306"})() at /root/.julia/packages/gdk_pixbuf_jll/kzXJa/src/wrappers/arm-linux-gnueabihf.jl:50
 [7] withenv(::gdk_pixbuf_jll.var"#8#9"{Gtk.var"#300#306"}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at ./env.jl:161
 [8] #gdk_pixbuf_query_loaders#7(::Bool, ::Bool, ::typeof(gdk_pixbuf_jll.gdk_pixbuf_query_loaders), ::Gtk.var"#300#306") at /root/.julia/packages/gdk_pixbuf_jll/kzXJa/src/wrappers/arm-linux-gnueabihf.jl:49
 [9] gdk_pixbuf_query_loaders at /root/.julia/packages/gdk_pixbuf_jll/kzXJa/src/wrappers/arm-linux-gnueabihf.jl:33 [inlined]
 [10] __init__() at /drone/src/src/Gtk.jl:92
 [11] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:692
 [12] _require_from_serialized(::String) at ./loading.jl:743
 [13] _require(::Base.PkgId) at ./loading.jl:1034
 [14] require(::Base.PkgId) at ./loading.jl:922
 [15] require(::Module, ::Symbol) at ./loading.jl:917
 [16] include at ./boot.jl:328 [inlined]
 [17] include_relative(::Module, ::String) at ./loading.jl:1105
 [18] include(::Module, ::String) at ./Base.jl:31
 [19] include(::String) at ./client.jl:424
 [20] top-level scope at none:6
during initialization of module Gtk
in expression starting at /drone/src/test/runtests.jl:2

Copy link
Contributor

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks good. Eventually, this package should probably consider ceasing to use the cfunction_ hack entirely, but it's not immediately necessary to edit the other code.

@timholy timholy merged commit c2a91eb into master Jun 4, 2020
@timholy timholy deleted the jb/fix1.5 branch June 4, 2020 21:04
@timholy
Copy link
Member

timholy commented Jun 4, 2020

@tknopp, with apologies to you I presumed to release 1.1.4, so it doesn't hold back progress on the Julia 1.5 release.

@tknopp
Copy link
Collaborator

tknopp commented Jun 4, 2020

That is just fine. Wanted to have a look at this right now but am happy that things are already done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants