Closed posxposy closed 3 years ago
@ncannasse , still not work with the latest Haxe.
This MainLoop.add
executes too: https://github.com/HeapsIO/heaps/blob/master/hxd/System.hl.hx#L403
which will cause the same error.
I tried to move it out of the __init__
magic as you did in your commit but ~got just a black screen.~
Ah, the black screen happens to me because of DCE, so @:keep
helps with it.
Something like this:
@:keep
static var _ = {
#if !usesys
haxe.MainLoop.add(timeoutTick, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
#end
#if (hlsdl || hldx)
haxe.MainLoop.add(updateCursor, -1) #if (haxe_ver >= 4) .isBlocking = false #end;
#end
null;
}
will now cause null pointer exception here, where this
is null:
https://github.com/HaxeFoundation/haxe/blob/development/std/hl/_std/sys/thread/Thread.hx#L53
I also get this error with HL target.
While MainLoop.add
bug is resolved fairly easily, there's a larger issue with Heaps on Haxe 4.2. Specifically with how 4.2 handles timers. They are now ran through the EventLoop
. And at boot there are 3 scheduled events to run:
System.runMainLoop
, Driver.init
and MainLoop
update function exactly in that order. Now here's the catch: runMainLoop
does the while(true)
, essentially locking out Driver.init
and MainLoop
from ever being fired, and subsequently: Driver never gets initialized, Engine never gets initialized and App never gets initialized past the "startup engine" phase.
Waiting for this to be fixed to release updated Heaps on haxelib
Updated heaps.io with git master documentation
FYI for other Heaps users: I worked around this by using https://github.com/asdf-community/asdf-haxe and downgrading to Haxe 4.1.5, which fixed it perfectly. You could also just install Haxe 4.1.5 yourself if you don't use asdf.
@ncannasse Not sure where you put this on the website -- I just spent a couple hours figuring this out and didn't see any mention in the documentation. Maybe I missed it somewhere?
I did the same. Patch day, no play, that's a classic one :) I will just wait for 4.2.1 fix.
Hello! I tried Heaps with latest Haxe (4.2, nightly) and got segfault on start: access violation.
Looks like it comes from here: https://github.com/HeapsIO/heaps/blob/master/hxd/System.hl.hx#L406
Because the mutex variable is now static here, it is not yet initialized before
__init__
call inhxd/System.hl.hx
: https://github.com/HaxeFoundation/haxe/commit/3070d07a0a16ac07e4da006f44f9cbbbc7a041da#diff-0fad0e326002cc0420a695052be93c4ebac0136f598f014e380c6a0246958feaR65So mutex is null at this place and application will crash: https://github.com/HaxeFoundation/haxe/commit/3070d07a0a16ac07e4da006f44f9cbbbc7a041da#diff-0fad0e326002cc0420a695052be93c4ebac0136f598f014e380c6a0246958feaR114