diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-29 13:26:47 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-29 13:26:47 +0100 |
commit | 259d830f06235e7bac25325bf355bcd5e126ac34 (patch) | |
tree | bdf4f2e0c87685a503eb9d40034755ddecc03b71 /src | |
parent | 4c1fac6db69efaea93e500dce9cb1129f2dba75e (diff) |
Properly cleanup embedded text items (2)
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index bc5346f..7f96263 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -260,6 +260,8 @@ namespace QuickMedia { void Body::clear_text_cache() { for(auto &body_item : items) { clear_body_item_cache(body_item.get()); + if(body_item->embedded_item) + clear_body_item_cache(body_item->embedded_item.get()); } } @@ -336,6 +338,8 @@ namespace QuickMedia { item_thumbnail_textures.clear(); for(auto &body_item : items) { clear_body_item_cache(body_item.get()); + if(body_item->embedded_item) + clear_body_item_cache(body_item->embedded_item.get()); } return; } @@ -459,6 +463,9 @@ namespace QuickMedia { for(auto &body_item : items) { if(elapsed_time_sec - body_item->last_drawn_time >= 1.5) clear_body_item_cache(body_item.get()); + // The embedded item might or might not refer to another item in |items|, so we have to make sure we also check it + if(body_item->embedded_item && elapsed_time_sec - body_item->embedded_item->last_drawn_time >= 1.5) + clear_body_item_cache(body_item->embedded_item.get()); } } @@ -543,9 +550,6 @@ namespace QuickMedia { body_item->timestamp_text.reset(); body_item->dirty_timestamp = true; } - - if(body_item->embedded_item) - clear_body_item_cache(body_item->embedded_item.get()); } sf::Vector2i Body::get_item_thumbnail_size(BodyItem *item) const { |