Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -61,11 +61,11 @@ id retval; #endif } /** - * \param obj An object that is passed to the main method + * \param obj An object that is passed to the main method as a copy * \return A new, autoreleased thread */ + threadWithObject: (id)obj; /** @@ -87,11 +87,11 @@ * \param key The Thread Local Storage key */ + (id)objectForTLSKey: (OFTLSKey*)key; /** - * \param obj An object that is passed to the main method + * \param obj An object that is passed to the main method as a copy * \return An initialized OFThread. */ - initWithObject: (id)obj; /** Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -81,11 +81,11 @@ - initWithObject: (id)obj { Class c; self = [super init]; - object = obj; + object = [obj copy]; #ifndef _WIN32 if (pthread_create(&thread, NULL, call_main, self)) { #else if ((thread = @@ -141,10 +141,11 @@ TerminateThread(thread, 1); CloseHandle(thread); } #endif + [object release]; [super dealloc]; } @end @implementation OFTLSKey