Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: mojo/dart/embedder/mojo_natives.cc

Issue 1060993005: Fix invalid call to Dart_NewSendPort with port id 0 in dart controller (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/embedder/mojo_natives.cc
diff --git a/mojo/dart/embedder/mojo_natives.cc b/mojo/dart/embedder/mojo_natives.cc
index 028f57ae66bfcd8a5d7591f127af6d795d72d589..8f1e7c5559789f060f461395e625c8672944a94a 100644
--- a/mojo/dart/embedder/mojo_natives.cc
+++ b/mojo/dart/embedder/mojo_natives.cc
@@ -729,7 +729,7 @@ void MojoHandleWatcher_SendControlData(Dart_NativeArguments arguments) {
CHECK_INTEGER_ARGUMENT(arguments, 1, &client_handle, InvalidArgument);
Dart_Handle send_port_handle = Dart_GetNativeArgument(arguments, 2);
- Dart_Port send_port_id = 0;
+ Dart_Port send_port_id = ILLEGAL_PORT;
if (!Dart_IsNull(send_port_handle)) {
Dart_Handle result = Dart_SendPortGetId(send_port_handle, &send_port_id);
if (Dart_IsError(result)) {
@@ -768,7 +768,9 @@ void MojoHandleWatcher_RecvControlData(Dart_NativeArguments arguments) {
Dart_Handle list = Dart_NewList(3);
Dart_ListSetAt(list, 0, Dart_NewInteger(cd.handle));
- Dart_ListSetAt(list, 1, Dart_NewSendPort(cd.port));
+ if (cd.port != ILLEGAL_PORT) {
+ Dart_ListSetAt(list, 1, Dart_NewSendPort(cd.port));
+ }
Dart_ListSetAt(list, 2, Dart_NewInteger(cd.data));
Dart_SetReturnValue(arguments, list);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698