Skip to content

Commit 6d5e23c

Browse files
authored
EventLoop: fix null access .stop in run (#12399)
1 parent d776100 commit 6d5e23c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

std/haxe/EventLoop.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Event {
4040
}
4141

4242
/**
43-
Stop this event from repeating.
43+
Start the event with the given callback function.
4444
**/
4545
public function start( callb : Void -> Void ) {
4646
this.callb = callb;
@@ -203,8 +203,8 @@ class EventLoop {
203203
Add a function to be run once at next loop of the event loop.
204204
**/
205205
public function run( callb : Void -> Void, priority = 0 ) : Event {
206-
var e : Event = null;
207-
e = add(function() { e.stop(); callb(); }, priority);
206+
var e : Event = new Event(this,priority);
207+
e.start(function() { e.stop(); callb(); });
208208
return e;
209209
}
210210

0 commit comments

Comments
 (0)