Skip to content

Commit

Permalink
C++ specific fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
xFrednet committed Nov 12, 2024
1 parent 54aadbb commit 6fdd340
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/rt/objects/dyn_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ namespace rt::objects
template<typename Pre, typename Post>
inline void visit(Region* start, Pre pre, Post post)
{
for (auto obj : start->objects)
for (auto obj : start->get_objects())
{
visit(obj, pre, post);
}
Expand Down
5 changes: 3 additions & 2 deletions src/rt/objects/region.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ namespace rt::objects
collecting = true;

std::cout << "Starting collection" << std::endl;
for (auto r : to_collect)
while (!to_collect.empty())
{
auto r = *to_collect.begin();
dirty_regions.erase(r);
to_collect.erase(r);
// Note destruct could re-enter here, ensure we don't hold onto a
// pointer into to_collect.
for (auto o : r->objects)
Expand All @@ -214,7 +216,6 @@ namespace rt::objects
delete r;
}
std::cout << "Finished collection" << std::endl;
to_collect.clear();
collecting = false;
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/rt/rt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ namespace rt
objects::DynObject*
set(objects::DynObject* obj, std::string key, objects::DynObject* value)
{
assert(obj && "Given nullptr, expected a valid DynObject pointer");
if (!obj) {
ui::error("fields can't be set on `None`");
}
return obj->set(key, value);
}

Expand Down

0 comments on commit 6fdd340

Please sign in to comment.