<asterite>
If you print the pointer and the closure_data before passing it to notification_add_action, and then you print it in the callback, they differ?
<jhass>
note this doesn't happen always
shama has quit [Remote host closed the connection]
<jhass>
it happens after some random time
<jhass>
which is why suspected GC
<jhass>
I'll let the Box version run for a while
shama has joined #crystal-lang
<asterite>
I think the Box version might also crash, because the memory is not retained...
knoopx has quit [Remote host closed the connection]
shama has quit [Remote host closed the connection]
ismaelga has quit [Remote host closed the connection]
shama has joined #crystal-lang
shama has quit [Read error: Connection reset by peer]
shama has joined #crystal-lang
ismaelga has joined #crystal-lang
shama has quit [Ping timeout: 264 seconds]
ismaelga has quit [Ping timeout: 245 seconds]
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 256 seconds]
bcardiff has joined #crystal-lang
havenn has quit []
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 256 seconds]
bcardiff has quit [Quit: Leaving.]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 272 seconds]
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 272 seconds]
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 250 seconds]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 246 seconds]
waj has joined #crystal-lang
ismaelga has joined #crystal-lang
ismaelga has quit [Ping timeout: 265 seconds]
ismaelga has joined #crystal-lang
waj has quit [Quit: Leaving.]
ismaelga has quit [Ping timeout: 240 seconds]
ismaelga has joined #crystal-lang
waj has joined #crystal-lang
bcardiff has joined #crystal-lang
asterite has joined #crystal-lang
<crystal-gh>
[crystal] asterite pushed 1 new commit to master: http://git.io/ADZI
<crystal-gh>
crystal/master e630eac Ary Borenszweig: Improved error message when including/extending a class, and added missing location for "self" in those cases. Related to #446
<travis-ci>
manastech/crystal#2055 (master - e630eac : Ary Borenszweig): The build is still failing.
<jhass>
asterite: so looks like all my issues are indeed GC related, in particular GC seems to cleans up objects still referenced by closure data passed to external callbacks
<jhass>
I say that since it works flawlessly if I disable GC
<asterite>
But that happens even if you store that closure in a global variable?
<jhass>
have to check that for the GLib idle/timer stuff yet, but I mean there should be a way to solve it without
<waj>
there are two options: let the GC "see" the object when it runs the mark/sweep, or don't allocate the object with the GC (use plain old malloc)
<jhass>
I'm not sure I follow about the first one, the second one I cannot do as a library, each caller would need to be aware, which is bad
ismaelga has quit [Remote host closed the connection]
<waj>
the first one means that the object must be reachable for the GC
<asterite>
Will these callbacks ever be deregistered?
<asterite>
I mean, is there a way to deregister those?
<jhass>
most take a callback for when the user data should be free'd, yes
<asterite>
I think it's what waj said: we need to add a GC.add_root(…) and GC.remove_root(…) method, or you can store that callback in a global/class variable
<jhass>
the strange thing is that .closure_data seems to remain in tact, but the objects referenced by seem to be GC'd
<jhass>
or mabye I'm misinterpreting .closure_data itself turns into garbage and that just causes bad references for everything else
<jhass>
but doesn't error out on its own
<asterite>
You mean, the address of the closure data remains the same?
<jhass>
I think so, yeah
<jhass>
mmh, well, the address is the only thing that I pass
<jhass>
so that stays the same of course
<jhass>
essentially what I'd like to have is a way to mark a closure data as "never free this or anything referenced by it", optionally with a "okay, freeing this now is okay from my side, do it when you think it's okay"
<asterite>
I think that's basically GC.add_root, GC.remove_root
<asterite>
which we don't have right now, but boehm provides that
<asterite>
so we need to wrap it
<waj>
the add_root must be called each time
<waj>
so you still must have a reference somewhere