diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c index cbef3c2fa..7de768b6a 100644 --- a/frontends/amiga/libs.c +++ b/frontends/amiga/libs.c @@ -113,7 +113,9 @@ #define AMINS_CLASS_CLOSE(PREFIX) \ if(I##PREFIX) DropInterface((struct Interface *)I##PREFIX); \ - if(PREFIX##Base) CloseClass(PREFIX##Base); + if(PREFIX##Base) CloseClass(PREFIX##Base); \ + I##PREFIX = NULL; \ + PREFIX##Base = NULL; #define AMINS_CLASS_STRUCT(PREFIX) \ struct ClassLibrary *PREFIX##Base = NULL; \ @@ -136,7 +138,8 @@ } #define AMINS_LIB_CLOSE(PREFIX) \ - if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base); + if(PREFIX##Base) CloseLibrary((struct Library *)PREFIX##Base); \ + PREFIX##Base = NULL; #define AMINS_LIB_STRUCT(PREFIX) \ struct PREFIX##Base *PREFIX##Base = NULL; @@ -156,7 +159,8 @@ } #define AMINS_CLASS_CLOSE(PREFIX) \ - if(PREFIX##Base) CloseLibrary(PREFIX##Base); + if(PREFIX##Base) CloseLibrary(PREFIX##Base); \ + PREFIX##Base = NULL; #define AMINS_CLASS_STRUCT(PREFIX) \ struct Library *PREFIX##Base = NULL; \ diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c index 2d2da3899..ee4e34a10 100644 --- a/frontends/amiga/schedule.c +++ b/frontends/amiga/schedule.c @@ -170,7 +170,11 @@ static nserror schedule_remove(void (*callback)(void *p), void *p, bool abort) if(nscb != NULL) { if(abort == true) ami_schedule_remove_timer_event(nscb); +#ifdef __amigaos4__ FreeSysObject(ASOT_IOREQUEST, nscb); +#else + FreeVec(nscb); +#endif pblHeapConstruct(schedule_list); } @@ -190,7 +194,11 @@ static void schedule_remove_all(void) { ami_schedule_remove_timer_event(nscb); pblIteratorRemove(iterator); +#ifdef __amigaos4__ FreeSysObject(ASOT_IOREQUEST, nscb); +#else + FreeVec(nscb); +#endif }; pblIteratorFree(iterator); @@ -337,7 +345,7 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p) TAG_DONE); #else if(schedule_msgport == NULL) return NSERROR_NOMEM; - nscb = (struct nscallback *)CreateIORequest(schedule_msgport, sizeof(struct nscallback)); + nscb = AllocVec(sizeof(struct nscallback), MEMF_PUBLIC | MEMF_CLEAR); *nscb = *tioreq; #endif if(!nscb) return NSERROR_NOMEM;