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

Unified Diff: bin/main.cc

Issue 8371016: Fix infinite recursion when dealing with cyclic library dependencies. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 2 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 | « bin/file_win.cc ('k') | bin/process_script.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/main.cc
===================================================================
--- bin/main.cc (revision 651)
+++ bin/main.cc (working copy)
@@ -189,8 +189,15 @@
// Create an isolate. As a side effect, MainIsolateInitCallback
// gets called, which loads the scripts and libraries.
- Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer, script_name);
+ char* canonical_script_name = File::GetCanonicalPath(script_name);
+ if (canonical_script_name == NULL) {
+ fprintf(stderr, "Unable to find '%s'\n", script_name);
+ return 255; // Indicates we encountered an error.
+ }
+ Dart_Isolate isolate = Dart_CreateIsolate(snapshot_buffer,
+ canonical_script_name);
if (isolate == NULL) {
+ free(canonical_script_name);
return 255;
}
@@ -203,17 +210,19 @@
fprintf(stderr, "%s\n", Dart_GetErrorCString(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
+ free(canonical_script_name);
return 255; // Indicates we encountered an error.
}
}
// Lookup and invoke the top level main function.
- Dart_Handle script_url = Dart_NewString(script_name);
+ Dart_Handle script_url = Dart_NewString(canonical_script_name);
Dart_Result result = Dart_LookupLibrary(script_url);
if (!Dart_IsValidResult(result)) {
fprintf(stderr, "%s\n", Dart_GetErrorCString(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
+ free(canonical_script_name);
return 255; // Indicates we encountered an error.
}
Dart_Handle library = Dart_GetResult(result);
@@ -238,12 +247,14 @@
fprintf(stderr, "\n");
Dart_ExitScope();
Dart_ShutdownIsolate();
+ free(canonical_script_name);
return 255; // We had an unhandled exception, hence indicate an error.
}
} else {
fprintf(stderr, "%s\n", Dart_GetErrorCString(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
+ free(canonical_script_name);
return 255; // Indicates we encountered an error.
}
// Keep handling messages until the last active receive port is closed.
@@ -252,8 +263,10 @@
fprintf(stderr, "%s\n", Dart_GetErrorCString(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
+ free(canonical_script_name);
return 255; // Indicates we encountered an error.
}
+ free(canonical_script_name);
Dart_ExitScope();
// Dump symbol information for the profiler.
DumpPprofSymbolInfo();
« no previous file with comments | « bin/file_win.cc ('k') | bin/process_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698