sciter-sdk
sciter-sdk copied to clipboard
Segfault when a "modern" event handler is declared inside a function
Modern event handlers seem pretty broken when declared inside a function.
As a minimal example, this code:
<html>
<script type="text/tiscript">
function foo() {
event mousedown {
stdout.println("M")
}
stdout.println("R")
}
foo()
</script>
</html>
Results in a segfault in my machine.
For some reason, commenting out the "R"
print statement prevents the segfault, but the "M"
message isn't printed.
I'm using the Rust bindings to 64-bit Sciter 4.4.2.4
, on a Windows 10 machine.
By the way, really cool library.
Confirmed here, thanks, looking.
But the code makes no sense anyway. Event handlers should always have a "principal" - DOM element they are attached to.
So either one of these
// global handler, set on document (a.k.a. `self`)
event mousedown {
stdout.println("M")
}
foo();
Or
function foo() {
// mousedown on <body> element
$(body) << event mousedown {
stdout.println("M")
}
stdout.println("R")
}
foo()
Or
class Some : Element {
event mousedown {
stdout.println("M");
}
}
The last one assumes that you have in CSS something like this:
div.some {
prototype: Some url(some.tis); // subclassing
}