Closed ghost closed 5 years ago
This might be a SDL bug. Have you tried adding logging to see if everything is still running?
The main loop is running, based on logging. What I can't understand is how this would be an SDL bug. I agree that it seems quite plausible given that the loop is still running, however, as far as I can tell based on the code, SDL and the Grid class have no interaction with each other, so I can't understand why adding that field would cause the window not to open.
The SDL bindings could be implemented in a wrong way. Mostly likely the struct's sizes are not the correct ones and so the stack memory is being overrun by something else and that causes the segmentation fault.
@asterite What segmentation fault? The program runs... it's just that the window doesn't open...
Just made an interesting discovery: putting a puts statement in the main loop (or above it) ALSO prevents the window from opening...
Ah, sorry, well, just incorrect behavior then.
I would open this issue in the SDL project/shard.
So it appears that the solution to this was to call window.update
. The fact that the code works as is without --release
makes me think that this is a compiler bug of some kind. Whether it be the Crystal compiler itself or an issue with LLVM... to me, the behavior should not change between debug and release builds.
Still reproduces using Crystal 0.29.0-dev [397bfe6e9]
Works now. I see an empty black UI window when I run program.
Let's close this. It's. probably related to SDL bindings.
Crystal 0.26.1 (2018-09-27) LLVM: 6.0.1 Default target: x86_64-pc-linux-gnu
I am running Antergos (Arch Linux).
I have the following code:
Here's my shard.yml:
If I uncomment the two commented lines, the program compiles and 'runs', but the window never opens. This only happens on a release build; without --release, it works fine. I haven't been able to get any kind of error out of it thus far.