Fix GameStateSnapshots not being freed

Updated GameStateSnapshot to inherit from RefCounted, to be automatically deleted when reference count reaches zero, and removed GameStateSnapshotRef wrapper class.
This commit is contained in:
aaronp64
2025-11-30 12:48:09 -05:00
parent 7ed0b61676
commit ed6181c943
4 changed files with 25 additions and 49 deletions
@@ -69,9 +69,9 @@ protected:
HashMap<int, PartialSnapshot> partial_snapshots;
LocalVector<SnapshotView *> views;
Ref<GameStateSnapshotRef> current_snapshot;
Ref<GameStateSnapshotRef> diff_snapshot;
LRUCache<String, Ref<GameStateSnapshotRef>> snapshot_cache;
Ref<GameStateSnapshot> current_snapshot;
Ref<GameStateSnapshot> diff_snapshot;
LRUCache<String, Ref<GameStateSnapshot>> snapshot_cache;
void _request_object_snapshot();
void _begin_object_snapshot();
@@ -95,7 +95,7 @@ public:
void receive_snapshot(int p_request_id);
void show_snapshot(const String &p_snapshot_file_name, const String &p_snapshot_diff_file_name);
void clear_snapshot(bool p_update_view_tabs = true);
Ref<GameStateSnapshotRef> get_snapshot(const String &p_snapshot_file_name);
Ref<GameStateSnapshot> get_snapshot(const String &p_snapshot_file_name);
void set_enabled(bool p_enabled);
void add_view(SnapshotView *p_to_add);