garetxe on master
haskell-gi-base 0.26.3 haskell-gi-0.26 Fix for nullable parameter in r… (compare)
WARNING: Accessing a disowned pointer <0x00000000649d0680>, this may lead to crashes.
• Callstack for the unsafe access to the pointer:
CallStack (from HasCallStack):
notOwnedWarning, called at .\\Data\\GI\\Base\\ManagedPtr.hs:194:25 in haskell-gi-ba_-0.25.0-e54f296d31598ac13124f52c63d6d957a696495e:Data.GI.Base.ManagedPtr
unsafeManagedPtrCastPtr, called at .\\GI\\Gtk\\Objects\\GestureSingle.hs:584:17 in gi-gtk-4.0.4-f0386fac927306f5dfd453fb2b725fbcae403b0c:GI.Gtk.Objects.GestureSingle
gestureSingleGetCurrentButton, called at src/app\MetaBrush\Event.hs:106:25 in main:MetaBrush.Event
• The pointer was disowned at:
CallStack (from HasCallStack):
disownManagedPtr, called at .\\Data\\GI\\Base\\ManagedPtr.hs:335:15 in haskell-gi-ba_-0.25.0-e54f296d31598ac13124f52c63d6d957a696495e:Data.GI.Base.ManagedPtr
disownObject, called at .\\GI\\Gtk\\Objects\\Widget.hs:5847:20 in gi-gtk-4.0.4-f0386fac927306f5dfd453fb2b725fbcae403b0c:GI.Gtk.Objects.Widget
widgetAddController, called at src/app\MetaBrush\Application.hs:489:3 in main:MetaBrush.Application
(transfer null)
in the introspection data, which means that managing its memory becomes the responsibility of the widget. And in particular, haskell-gi
has no way of knowing if the underlying pointer it's alive after the call (well, currently, in principle it could detect it, but I haven't implemented it yet).
I have callbacks of the form
void $ GTK.afterGestureClickPressed viewportClicksController
( handleMouseButtonEvent viewportClicksController )
which monitors clicks in a certain drawing area for user interaction over that area
handleMouseButtonEvent gestureClick nbClicks x y
has code like do { button <- GTK.gestureSingleGetCurrentButton gestureClick; handleAction (MouseClick (Point2D x y) button nbClicks) }
, usual stuff really
self
argument in the callback somehow), but I need to think about the best way to expose this in the bindings
source-repository-package
stanza to my cabal.project
pointing to that commit but I can't do that here, could you advise?
haskell-gi
and haskell-gi-base
from github, the bindings themselves (the gi-*
packages) in hackage should be OK. Just make sure that they are regenerated (removing your .dist-newstyle
should do the job).
Is there an example project or howto how to use GTK4 + haskell-gi and stack?
Unfortunately nothing that I am aware of. It should be possible to do by adding enough packages to your stack.yaml
, there is some relevant discussion in haskell-gi/haskell-gi#339
cabal
before going into that. At least for building haskell-gi
generated bindings it is often easier with cabal
.
How would you translate
new Gtk.Window [ On #destroy Gtk.mainQuit ]
`
to code that doesn't use labels?