1
0
Fork 0

Use shared_ptr to prevent double free on imageDisk

Also, replacing unique_ptr with shared_ptr makes it unnecessary to move
a pointer when swapping boot disks; moving shared_ptr would lead to
inconsistent internal state.

Fixes: #94
This commit is contained in:
Patryk Obara 2019-12-18 16:57:48 +01:00 committed by Patryk Obara
parent 70a1f9f0d1
commit 5f282f6015
4 changed files with 23 additions and 42 deletions

View file

@ -185,7 +185,7 @@ public:
Bit32u getFirstFreeClust(void);
bool directoryBrowse(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum, Bit32s start=0);
bool directoryChange(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum);
std::unique_ptr<imageDisk> loadedDisk;
std::shared_ptr<imageDisk> loadedDisk;
bool created_successfully;
private:
Bit32u getClusterValue(Bit32u clustNum);