mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-26 03:32:33 +00:00
Fix bug where RomLink handles weren't locked
Pointers to relocatable blocks were being kept and re-used! Now HLock is correctly used to keep the blocks in place. This is Memory Manager 101.
This commit is contained in:
parent
6788160911
commit
a855f682c6
@ -61,6 +61,9 @@ void get_program(unsigned char **prog_p, long *len_p, unsigned char *name)
|
|||||||
fprintf(stderr, "Could not find program \"%.*s\"\n", *name, name+1);
|
fprintf(stderr, "Could not find program \"%.*s\"\n", *name, name+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MoveHHi(hdl);
|
||||||
|
HLock(hdl);
|
||||||
|
|
||||||
*prog_p = *(unsigned char **)hdl;
|
*prog_p = *(unsigned char **)hdl;
|
||||||
*len_p = GetHandleSize(hdl);
|
*len_p = GetHandleSize(hdl);
|
||||||
}
|
}
|
||||||
@ -68,7 +71,9 @@ void get_program(unsigned char **prog_p, long *len_p, unsigned char *name)
|
|||||||
|
|
||||||
void free_program(unsigned char *prog)
|
void free_program(unsigned char *prog)
|
||||||
{
|
{
|
||||||
DisposeHandle(RecoverHandle((Ptr)prog));
|
Handle hdl = RecoverHandle((Ptr)prog);
|
||||||
|
HUnlock(hdl);
|
||||||
|
DisposeHandle(hdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user