Fixed default thread stack size.

diff --git a/scheduler/thread.c b/scheduler/thread.c
index 9499d75..f9d7105 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -132,6 +132,16 @@
     if (stack_size >= 16*1024*1024)
     	WARN("Thread stack size is %ld MB.\n",stack_size/1024/1024);
 
+    /* if size is smaller than default, get stack size from parent */
+    if (stack_size < 1024 * 1024)
+    {
+        if (teb)
+            stack_size = 1024 * 1024;  /* no parent */
+        else
+            stack_size = ((char *)NtCurrentTeb()->stack_top - (char *)NtCurrentTeb()->stack_base
+                          - SIGNAL_STACK_SIZE - 3 * page_size);
+    }
+
     /* FIXME: some Wine functions use a lot of stack, so we add 64Kb here */
     stack_size += 64 * 1024;