File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,9 @@ class FileSystemMemory : public FileSystem {
169169 FS_LOGW (" open: entry invalid: %s" , path);
170170 return -1 ;
171171 }
172- entry.content = mem_entry.content ;
172+ // copy content, so that we can delete the entry.content when it is closed
173+ entry.content = new RegContentMemory ();
174+ *entry.content = *mem_entry.content ;
173175 return entry.fileID ;
174176 }
175177
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ struct RegEntry {
9090 RegEntry () = default ;
9191 ~RegEntry () {
9292 if (content != nullptr ) {
93+ FS_LOGD (" ~RegEntry: %s" , file_name);
9394 delete content;
9495 content = nullptr ;
9596 }
@@ -193,9 +194,6 @@ class Registry {
193194 FS_TRACED ();
194195 RegEntry *p_entry = open_files[fileID];
195196 if (p_entry != nullptr ) {
196- if (p_entry->content != nullptr ) {
197- delete p_entry->content ;
198- }
199197 delete p_entry;
200198 open_files[fileID] = nullptr ;
201199 }
You can’t perform that action at this time.
0 commit comments