diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 9ec9f22c7..d944bf357 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -476,7 +476,8 @@ struct graph_t // it's parent where possible. int64_t modified_distance = - hb_clamp (distance + distance_modifier (), (int64_t) 0, 0x7FFFFFFFFFF); + hb_clamp (distance + distance_modifier (), (int64_t) 0, + hb_int_max (int64_t) >> 18); if (has_max_priority ()) { modified_distance = 0; } @@ -938,6 +939,17 @@ public: { TRY (update_parents ()); + for (auto& vertex : vertices_.writer ()) + { + vertex.space = 0; + vertex.priority = 0; + } + num_roots_for_space_.resize (1); + TRY (graph_result_t::from (num_roots_for_space_, ALLOCATION_FAILURE)); + num_roots_for_space_[0] = 1; + distance_invalid = true; + positions_invalid = true; + hb_set_t visited; hb_set_t roots; TRY (find_space_roots (visited, roots));