diff options
-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 { |