asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.0 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ - API: http://crystal-lang.org/api/ - Logs: http://irclog.whitequark.org/crystal-lang
<jhass> weskinner_work: well, maybe there are other return codes than 1 and 0?
<jhass> or maybe it's because crystal does not (yet) zero out parameters upon initialization
<jhass> so it's initialized with different garbage inside the function and outside
<jhass> small style note: while ! -> until
<weskinner_work> ahh ok that makes sense
<jhass> so maybe try event = LibSDL2::Whatever.new; and then pass pointerof(event)
<jhass> since that zeros
<weskinner_work> hmm, it's still segfaulting with the == 1 form and pointerof(event)
<jhass> mmh, try crystal build --debug foo.cr and valgrind ./foo
<jhass> maybe that gives some more hints
<jhass> and yes, it'll take forever to boot that way ;)
<weskinner_work> ==40161== General Protection Fault
<weskinner_work> ==40161== at 0x4EE2088: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2.0)
<weskinner_work> ==40161== by 0x406886: *SDL2::Window#get_surface<SDL2::Window>:Pointer(LibSDL2::Surface) (window.cr:17)
<weskinner_work> line 31 in my gist
<jhass> oh?
<weskinner_work> odd
<jhass> mmh, does it still segfault with GC_DONT_GC=1 ?
endou has quit [Read error: Connection reset by peer]
endou has joined #crystal-lang
<jhass> oh, btw, other small style note: there's File.join ;)
<jhass> >> __dir__
<DeBot> jhass: Error in line 3: undefined local variable or method '__dir__'
<jhass> >> __DIR__
<DeBot> jhass: "."
<jhass> mmh, and that thing
<weskinner_work> jhass: $ GC_DONT_GC=1 ./main ?
<weskinner_work> or do i need to build with that?
<jhass> yes like that, runtime thing
<weskinner_work> still segs
<weskinner_work> also thanks for the File.join tip :)
<jhass> which address does it try to access?
<jhass> is it 0 or some garbage?
<weskinner_work> ==40161== Address 0x530000441f0f6600 is not stack'd, malloc'd or (recently) free'd
<weskinner_work> here's the whole thing
<weskinner_work> ==40161== Invalid read of size 8
<weskinner_work> ==40161== at 0x4EE2088: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2.0)
<weskinner_work> ==40161== by 0x406886: *SDL2::Window#get_surface<SDL2::Window>:Pointer(LibSDL2::Surface) (window.cr:17)
<weskinner_work> ==40161== by 0x402935: __crystal_main (foo.cr:22)
<weskinner_work> ==40161== by 0x40308F: main (macro55852512.cr:43)
<weskinner_work> ==40161== Address 0x530000441f0f6600 is not stack'd, malloc'd or (recently) free'd
<jhass> can you extract the window.get_surface call to a local and do pp surface.to_unsafe to see which address it has?
<weskinner_work> here's window.cr line 17
<weskinner_work> 17 surface = LibSDL2.get_window_surface(@window)
<jhass> oh?
<jhass> a gist can take multiple files, maybe edit yours to your actual code? :)
<weskinner_work> yeah I was misinterpreting
<weskinner_work> that's where the seg is coming from so it must be an issue with @window
<jhass> yeah, sounds like it
<weskinner_work> gotta pack up, but thanks for the help jhass. not a major road block as I can just use the SDL2.poll_events form
<jhass> weskinner_work: well, chances are that it just changes memory layout so that the garbage doesn't cause a direct segfault
weskinner_work has quit [Ping timeout: 264 seconds]
weskinner_work has joined #crystal-lang
leex has quit [*.net *.split]
dom96 has quit [*.net *.split]
leex has joined #crystal-lang
dom96 has joined #crystal-lang
shama has quit [*.net *.split]
vifino has quit [*.net *.split]
waj has joined #crystal-lang
shama has joined #crystal-lang
vifino has joined #crystal-lang
waj has quit [*.net *.split]
shama has quit [*.net *.split]
vifino has quit [*.net *.split]
waj has joined #crystal-lang
shama has joined #crystal-lang
vifino has joined #crystal-lang
weskinner_work has quit [Ping timeout: 264 seconds]
weskinner_mac has joined #crystal-lang
weskinner_mac has joined #crystal-lang
weskinner_mac has quit [Client Quit]
waj has quit [Quit: Leaving.]
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
havenwood has joined #crystal-lang
weskinner_work has joined #crystal-lang
weskinner_work has quit [Ping timeout: 264 seconds]
weskinner_mac has joined #crystal-lang
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
weskinner_mac has quit [Quit: weskinner_mac]
weskinner_mac has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
weskinner_mac has quit [Quit: weskinner_mac]
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
shama has joined #crystal-lang
shama has quit [Remote host closed the connection]
bcardiff has joined #crystal-lang
bcardiff has quit [Quit: Leaving.]
havenwood has quit [Remote host closed the connection]
leafybasil has quit [Remote host closed the connection]
waj has joined #crystal-lang
leafybasil has joined #crystal-lang
waj1 has joined #crystal-lang
waj has quit [Ping timeout: 256 seconds]
ismaelga has joined #crystal-lang
waj1 has quit [Quit: Leaving.]
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
waj has joined #crystal-lang
weskinner_mac has joined #crystal-lang
waj has quit [Quit: Leaving.]
weskinner_work has joined #crystal-lang
waj has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 3 new commits to master: http://git.io/AdjI
<crystal-gh> crystal/master 4f6cbc2 Ary Borenszweig: Fixed: MatchData#begin and MatchData#end were returning byte index. Now they return char index. Also added MatchData#byte_begin and btye_end.
<crystal-gh> crystal/master ffd71d6 Ary Borenszweig: Doc: color strings in blue
<crystal-gh> crystal/master 866a0fc Ary Borenszweig: Added some documentation to String#new
bcardiff has joined #crystal-lang
weskinner_mac has quit [Quit: weskinner_mac]
<travis-ci> manastech/crystal#2059 (master - 866a0fc : Ary Borenszweig): The build has errored.
havenwood has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden opened pull request #450: @methods variable for def macros [wIP] (master...compiler-def-macro-methods) http://git.io/AFL6
<travis-ci> manastech/crystal#2061 (master - fd7011b : Ary Borenszweig): The build failed.
waj has quit [Quit: Leaving.]
bcardiff has quit [Quit: Leaving.]
leafybas_ has joined #crystal-lang
leafybasil has quit [Read error: Connection reset by peer]
bcardiff has joined #crystal-lang
waj has joined #crystal-lang
waj has quit [Client Quit]
havenn has joined #crystal-lang
havenwood has quit [Ping timeout: 265 seconds]
havenn is now known as havenwood
waj has joined #crystal-lang
leafybas_ has quit []
leafybasil has joined #crystal-lang
shama has joined #crystal-lang
weskinner_work has quit [Quit: weskinner_work]
weskinner_work has joined #crystal-lang
weskinner_work has quit [Quit: weskinner_work]
weskinner_work has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/ANZ4
<crystal-gh> crystal/master d64460c Ary Borenszweig: Fixed: allow newlines in macro expressions. Related to something mentioned in #450.
<crystal-gh> crystal/master febda50 Ary Borenszweig: Fixed #448: Metaprogramming: type inference degrades classes to their parents
ismaelga has quit [Remote host closed the connection]
waj has quit [Quit: Leaving.]
asterite has joined #crystal-lang
waj has joined #crystal-lang
<weskinner_work> jhass: just figured out the cause of my segfault
<weskinner_work> https://github.com/TheBlueCrane/SDL2-Crystal/blob/master/sdl2/lib_sdl2.cr#L160 . The union Event isn't large enough for other event types
<jhass> asterite: got another puzzle, I have the feeling it's a codegen bug. When this line is commented in http://paste.mrzyx.de/p2atfdazg#line-232 it causes this http://cloud.aeshna.de/u/mrzyx/screenshots/screenshot_20150225_204944.png which should root in this call http://paste.mrzyx.de/p2atfdazg#line-232 which is run here http://paste.mrzyx.de/p2atfdazg#line-232
<weskinner_work> should have been the first place I looked. just assumed that part was done because my simple example worked
<jhass> weskinner_work: hah, long live auto generated bindings :P
<weskinner_work> but like you said the memory layout must have been ok by chance
<asterite> weskinner_work: oh, right, I forgot to mention that when you don't map types well, things might get corrupted
<asterite> waj actually wants to have automatic bindings generated integrated into the language, and I'm starting to understand why it'll be very useful :)
<weskinner_work> adding a "pad : UInt8[1000]" member to KeyboardEvent fixed it for now :P
<jhass> asterite: meh, mixed up the line number markings
<asterite> don't worry :)
<asterite> Mmm… can you submit an issue? Possibly trying to reduce it...
<jhass> first one is correct, second is http://paste.mrzyx.de/p2atfdazg#line-138 and third is http://paste.mrzyx.de/p2atfdazg#line-224
<jhass> can't reduce it, it's literally that line in or out
<asterite> So if you comment that line everything works, but if you uncomment it then other parts start breaking?
<jhass> yeah
<jhass> like if you leave it in and comment back in the excception handling below, e points to garbage
<jhass> and in the current form response.body points to garbage
<asterite> I will need something I can reproduce locally :(
<jhass> can you maybe try in your ubuntu VM? get https://github.com/jhass/github_desktop_notifications and replace the file with the one in the pastebin. I really have no idea where to even start looking :/
<asterite> I'll try
<jhass> actually, I'll just push it into a branch
<jhass> asterite: codepaths in there might be a bit much indirection, if you need any explained, just ask ;)
<asterite> I think it would make sense for the compiler to give a message like "Missing libraries: …" when cc fails because of a missing library :)
<asterite> jhass: I get `Gtk-WARNING **: cannot open display: ` and then it ends. I guess I will need an ubuntu vm with a UI :)
<jhass> eh, yeah
<weskinner_work> is this intentional / unavoidable? enum Color; RED = 45; end; Color::RED != 45;
<asterite> Intentional. You can do Color::RED.value != 45
<asterite> But maybe we should consider comparing enums to raw values
<weskinner_work> it was easy enough to set the type of my struct member to the enum in my case
<weskinner_work> I think Color::RED == 45 would be expected though
<asterite> Probably, yes
<asterite> For now you can add it to enum
<asterite> >> struct Enum; def ==(other : Int); value == other; end; end; enum Color; R; G; B; end; Color::G == 1
<DeBot> asterite: true
havenwood has quit [Remote host closed the connection]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
havenwood has joined #crystal-lang
waj has quit [Quit: Leaving.]
knoopx has joined #crystal-lang
waj has joined #crystal-lang
leafybasil has joined #crystal-lang
leafybasil has quit [Remote host closed the connection]
asterite has quit [Quit: Leaving.]
asterite has joined #crystal-lang
asterite has quit [Client Quit]
bcardiff has quit [Quit: Leaving.]
havenwood has quit [Remote host closed the connection]
waj has quit [Quit: Leaving.]
havenwood has joined #crystal-lang
ismaelga has joined #crystal-lang
waj has joined #crystal-lang
ismaelga has quit [Remote host closed the connection]
ismaelga has joined #crystal-lang
<weskinner_work> how do I create a fixed size array of UInt32?
<weskinner_work> nm
waj has quit [Quit: Leaving.]