Author: mmlr Date: 2009-11-07 17:33:29 +0100 (Sat, 07 Nov 2009) New Revision: 33940 Changeset: http://dev.haiku-os.org/changeset/33940/haiku Modified: haiku/trunk/src/system/kernel/thread.cpp Log: That was not such a good destruction order in the error case. As the scheduler accesses the scheduler data inside the thread structure, freeing it first lead to a crash when a thread couldn't be created. Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2009-11-07 11:53:34 UTC (rev 33939) +++ haiku/trunk/src/system/kernel/thread.cpp 2009-11-07 16:33:29 UTC (rev 33940) @@ -313,9 +313,10 @@ err1: // ToDo: put them in the dead queue instead? if (inthread == NULL) { + scheduler_on_thread_destroy(thread); free(thread); - scheduler_on_thread_destroy(thread); } + return NULL; }