Browse Source

allocate an empty ProtectedObject instance for external threads so that ActiveObject() returns a non-NIL value

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8396 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova 6 years ago
parent
commit
a39f6a7a58
1 changed files with 7 additions and 4 deletions
  1. 7 4
      source/Windows.Objects.Mod

+ 7 - 4
source/Windows.Objects.Mod

@@ -1152,10 +1152,11 @@ BEGIN
 	t.waitingOn := NIL; 
 #IF ~SHAREDLIB THEN
 	t.flags := {};
-#ELSE (*! mark the process as external (non A2) *)
-	t.flags := {External};
-#END;
 	t.obj := NIL;
+#ELSE 
+	t.flags := {External}; (*! mark the process as external (non A2) *)
+	NEW(t.obj); (*! required for ActiveObject() to return non-NIL *)
+#END;
 	t.mode := Unknown; t.body := NIL;
 	t.priority := Normal;
 	
@@ -1407,7 +1408,9 @@ END ReenterA2;
 
 		t.gcContext.nextPos := 0;
 		t.next := NIL;  t.prev := NIL;
-		t.waitingOn := NIL; t.flags := {External}; t.obj := NIL;
+		t.waitingOn := NIL; 
+		t.flags := {External}; (*! mark the process as external (non A2) *)
+		NEW(t.obj); (*! required for ActiveObject() to return non-NIL *)
 		t.mode := Unknown; t.body := NIL;
 
 		t.handle := Kernel32.GetCurrentThread();