snowkit / mint

A framework/renderer agnostic Minimal UI interface library for Haxe.
http://snowkit.github.io/mint/
MIT License
65 stars 19 forks source link

Signal; Guard against null when emitting #56

Closed anissen closed 8 years ago

anissen commented 8 years ago

This PR solves the particular case where the canvas is destroyed as a direct result of an emitted event but there are still more emitted events that needs to be resolved.

Concretely, I'm doing something like the following:

new mint.Button({
    // ...
    onclick: function(e,c) { canvas.destroy(); },
});

Here, the canvas is destroyed "on mouse down" but "on mouse up" is still queued to be emitted. This causes an exception in Signal because $ethis is null.

ruby0x1 commented 8 years ago

Ok, this looks fine short term! These signals needed some reconfiguring anyway (i.e #41 relates). Thanks!