summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xamiga/gui.c2
-rwxr-xr-xamiga/schedule.c22
2 files changed, 22 insertions, 2 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 061e6636d..5f638ebba 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2165,8 +2165,8 @@ void gui_quit(void)
if(IKeymap) DropInterface((struct Interface *)IKeymap);
if(KeymapBase) CloseLibrary(KeymapBase);
- ami_schedule_close_timer();
ami_schedule_free();
+ ami_schedule_close_timer();
FreeObjList(window_list);
}
diff --git a/amiga/schedule.c b/amiga/schedule.c
index d138e2323..d05d4b66e 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -117,6 +117,25 @@ void schedule_remove(void (*callback)(void *p), void *p)
if(restoreheap) pblHeapConstruct(schedule_list);
}
+void schedule_remove_all(void)
+{
+ PblIterator *iterator;
+ struct nscallback *nscb;
+
+ if(pblHeapIsEmpty(schedule_list)) return;
+
+ iterator = pblHeapIterator(schedule_list);
+
+ while ((nscb = pblIteratorNext(iterator)) != -1)
+ {
+ ami_remove_timer_event(nscb);
+ pblIteratorRemove(iterator);
+ FreeVec(nscb);
+ };
+
+ pblIteratorFree(iterator);
+}
+
/**
* Process events up to current time.
* This implementation only takes the top entry off the heap, it does not
@@ -186,7 +205,8 @@ BOOL ami_schedule_create(void)
void ami_schedule_free(void)
{
- pblHeapFree(schedule_list);
+ schedule_remove_all();
+ pblHeapFree(schedule_list); // this should be empty at this point
}
void ami_schedule_open_timer(void)