Make _cancelWakeup a no-op if _sendPort is null

This seems to fix the issue, but it's a flaky crash so it's hard to 100% verify.

Bug: https://github.com/dart-lang/sdk/issues/33838
Bug: https://github.com/flutter/devtools/issues/337
Change-Id: Ic037a94cfb9fe7da319d7d4b20e3a3efd0c7289f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97541
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
Liam Appelbe 2019-03-21 18:15:27 +00:00 committed by commit-bot@chromium.org
parent 8f827aef4f
commit 9622562482

View file

@ -430,9 +430,10 @@ class _Timer implements Timer {
// Cancel pending wakeups in the event handler.
static void _cancelWakeup() {
assert(_sendPort != null);
VMLibraryHooks.eventHandlerSendData(null, _sendPort, _NO_TIMER);
_scheduledWakeupTime = null;
if (_sendPort != null) {
VMLibraryHooks.eventHandlerSendData(null, _sendPort, _NO_TIMER);
_scheduledWakeupTime = null;
}
}
// Create a receive port and register a message handler for the timer