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

@ -81,8 +81,8 @@ void incrementFDD(void);
#define MAX_DISK_IMAGES (2 + MAX_HDD_IMAGES)
extern std::array<std::unique_ptr<imageDisk>, MAX_DISK_IMAGES> imageDiskList;
extern std::array<std::unique_ptr<imageDisk>, MAX_SWAPPABLE_DISKS> diskSwap;
extern std::array<std::shared_ptr<imageDisk>, MAX_DISK_IMAGES> imageDiskList;
extern std::array<std::shared_ptr<imageDisk>, MAX_SWAPPABLE_DISKS> diskSwap;
extern Bit32s swapPosition;
extern Bit16u imgDTASeg; /* Real memory location of temporary DTA pointer for fat image disk access */