Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -87,18 +87,22 @@ 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