mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
bugfix: When the DOS kernel shuts down, make sure the Drives[] array is
zeroed as well. Prior to this fix, mounting drive c: then booting a guest OS would leave behind stale (invalid) pointers in the Drives[] array once the BOOT program shut the DOS kernel down. This wouldn't cause any problems until you attempted to use the Disk Swap hotkey, at which point, DOSBox would crash.
This commit is contained in:
@@ -1727,7 +1727,10 @@ public:
|
||||
dos.version.minor=0;
|
||||
}
|
||||
~DOS(){
|
||||
for (Bit16u i=0;i<DOS_DRIVES;i++) delete Drives[i];
|
||||
for (Bit16u i=0;i<DOS_DRIVES;i++) {
|
||||
delete Drives[i];
|
||||
Drives[i] = NULL;
|
||||
}
|
||||
delete [] Files;
|
||||
}
|
||||
};
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
Bitu DOS_FILES = 127;
|
||||
DOS_File ** Files;
|
||||
DOS_Drive * Drives[DOS_DRIVES];
|
||||
DOS_Drive * Drives[DOS_DRIVES] = {NULL};
|
||||
|
||||
Bit8u DOS_GetDefaultDrive(void) {
|
||||
// return DOS_SDA(DOS_SDA_SEG,DOS_SDA_OFS).GetDrive();
|
||||
|
@@ -148,7 +148,7 @@ void swapInNextDisk(bool pressed) {
|
||||
/* Hack/feature: rescan all disks as well */
|
||||
LOG_MSG("Diskcaching reset for normal mounted drives.");
|
||||
for(Bitu i=0;i<DOS_DRIVES;i++) {
|
||||
if (Drives[i]) {
|
||||
if (Drives[i] != NULL) {
|
||||
Drives[i]->EmptyCache();
|
||||
Drives[i]->MediaChange();
|
||||
}
|
||||
|
Reference in New Issue
Block a user