mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-26 15:29:19 +00:00
SNEAKY BUGFIX race condition between UI thread and CPU thread on disk insertion
- Previously we would start the CPU thread and then insert, which has been a long standing race condition, but possibly better exposed since the recent disk.c rephactor to use mmap I/O - This directly manifested on a Kindle Fire 1st Gen as a crash, and, anecdotally on other devices as a "stalled" disk read requiring a reboot of the virtual machine. Yay for crappy devices helping to expose crappy code! (git blame me). =P
This commit is contained in:
parent
20f79dc5eb
commit
d4adabda93
@ -615,8 +615,6 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
mActivity.dismissAllMenus();
|
||||
boolean isDriveA = diskA.isChecked();
|
||||
boolean diskReadOnly = readOnly.isChecked();
|
||||
if (isDriveA) {
|
||||
@ -626,6 +624,8 @@ public class Apple2DisksMenu implements Apple2MenuView {
|
||||
Apple2Preferences.CURRENT_DISK_B_RO.saveBoolean(mActivity, diskReadOnly);
|
||||
Apple2Preferences.CURRENT_DISK_B.saveString(mActivity, imageName);
|
||||
}
|
||||
dialog.dismiss();
|
||||
mActivity.dismissAllMenus();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -311,6 +311,8 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeChooseDisk(JNIEnv *env, job
|
||||
int drive = driveA ? 0 : 1;
|
||||
int ro = readOnly ? 1 : 0;
|
||||
|
||||
assert(cpu_isPaused() && "considered dangerous to insert disk image when CPU thread is running");
|
||||
|
||||
LOG(": (%s, %s, %s)", path, driveA ? "drive A" : "drive B", readOnly ? "read only" : "read/write");
|
||||
if (disk6_insert(drive, path, ro)) {
|
||||
char *gzPath = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user