Skip to content

Commit

Permalink
Merge pull request #45 from slipher/resource-iter-bug
Browse files Browse the repository at this point in the history
Fix iterator bug
  • Loading branch information
slipher committed Oct 23, 2017
2 parents b01b9f7 + 1f5f8ea commit 84c07a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/engine/framework/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ namespace Resource {
Prune();

// And then load the new ones, so as to reduce peak memory usage.
for (auto it = resources.begin(); it != resources.end(); ++it) {
if (not it->second->loaded) {
if (not it->second->TryLoad()) {
it->second->Cleanup();
it = resources.erase(it);
}
for (auto it = resources.begin(); it != resources.end(); ) {
if (!it->second->loaded && !it->second->TryLoad()) {
it->second->Cleanup();
it = resources.erase(it);
} else {
++it;
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/shared/VMMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ int main(int argc, char** argv)
Sys::OSExit(1);
}
char* end;
Sys::OSHandle rootSocket = reinterpret_cast<Sys::OSHandle>(static_cast<int>(strtol(argv[1], &end, 10)));
#ifdef _WIN32
Sys::OSHandle rootSocket = reinterpret_cast<Sys::OSHandle>(static_cast<intptr_t>(strtol(argv[1], &end, 10)));
#else
Sys::OSHandle rootSocket = static_cast<Sys::OSHandle>(strtol(argv[1], &end, 10));
#endif
if (argv[1] == end || *end != '\0') {
fprintf(stderr, "Parameter is not a valid handle number\n");
Sys::OSExit(1);
Expand Down

0 comments on commit 84c07a6

Please sign in to comment.