Skip to content

Commit

Permalink
Fix an improper deletion of DirectoryAssetBundle when creating isolat…
Browse files Browse the repository at this point in the history
…es (flutter#4637)
  • Loading branch information
jason-simmons authored Feb 6, 2018
1 parent 9d93a07 commit c8bf225
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/dart_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Dart_Isolate ServiceIsolateCreateCallback(const char* script_uri,
static bool GetAssetAsBuffer(
const std::string& name,
std::vector<uint8_t>* data,
std::unique_ptr<DirectoryAssetBundle>& directory_asset_bundle,
fxl::RefPtr<DirectoryAssetBundle>& directory_asset_bundle,
fxl::RefPtr<ZipAssetStore>& asset_store) {
return (directory_asset_bundle &&
directory_asset_bundle->GetAsBuffer(name, data)) ||
Expand Down Expand Up @@ -340,15 +340,15 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri,

struct stat stat_result = {};
if (::stat(bundle_path.c_str(), &stat_result) == 0) {
std::unique_ptr<DirectoryAssetBundle> directory_asset_bundle;
fxl::RefPtr<DirectoryAssetBundle> directory_asset_bundle;
// TODO(zarah): Remove usage of zip_asset_store once app.flx is removed.
fxl::RefPtr<ZipAssetStore> zip_asset_store;
// bundle_path is either the path to app.flx or the flutter assets
// directory.
std::string flx_path = bundle_path;
if (S_ISDIR(stat_result.st_mode)) {
directory_asset_bundle =
std::make_unique<DirectoryAssetBundle>(bundle_path);
fxl::MakeRefCounted<DirectoryAssetBundle>(bundle_path);
flx_path = files::GetDirectoryName(bundle_path) + "/app.flx";
}

Expand Down

0 comments on commit c8bf225

Please sign in to comment.