@@ -77,28 +77,32 @@ #endif #ifndef OF_AMIGAOS # define closeHandle(h) close(h) #else -static struct _OFFileHandle +static struct _OFFileHandle { struct _OFFileHandle *previous, *next; BPTR handle; bool append; } *firstHandle = NULL; static void closeHandle(OFFileHandle handle) { Close(handle->handle); + + Forbid(); if (handle->previous != NULL) handle->previous->next = handle->next; if (handle->next != NULL) handle->next->previous = handle->previous; if (firstHandle == handle) firstHandle = handle->next; + + Permit(); OFFreeMemory(handle); } OF_DESTRUCTOR() @@ -289,18 +293,22 @@ exceptionWithPath: path mode: mode errNo: EIO]; } } + + Forbid(); handle->previous = NULL; handle->next = firstHandle; if (firstHandle != NULL) firstHandle->previous = handle; firstHandle = handle; + + Permit(); } @catch (id e) { OFFreeMemory(handle); @throw e; } #endif