Skip to content

Instantly share code, notes, and snippets.

@kevmoo
Created June 17, 2012 16:45
Show Gist options
  • Save kevmoo/2945042 to your computer and use it in GitHub Desktop.
Save kevmoo/2945042 to your computer and use it in GitHub Desktop.
Async crash in Dartium - 8641
#import('dart:html');
#import('dart:isolate');
SendPort sender;
ReceivePort receiver;
main(){
CanvasElement canvas = document.query("#content");
canvas.on.mouseMove.add(mouse);
canvas.on.mouseOut.add(mouse);
sender = spawnFunction(childIsolate);
receiver = new ReceivePort();
receiver.receive((msg, _) {
print('we got a message');
print(msg);
});
sender.send("do work please", receiver.toSendPort());
}
void mouse(MouseEvent e) {
print("mouse!");
print(e);
sender.send('mouse!');
}
void childIsolate() {
//print('hello?');
port.receive((msg, SendPort replyTo) {
//print(msg);
//print('doing some work');
replyTo.send('yo!');
});
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="application/dart" src="async_demo.dart"></script>
<script src="http://dart.googlecode.com/svn/trunk/dart/client/dart.js"></script>
<canvas height='500' id='content' width='500' style='background: blue;'></canvas>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment