ObjFHandle.st
changeset 367 87d4673fbd06
parent 304 4f44c64cb245
child 368 26e9268bde0f
--- a/ObjFHandle.st	Thu Oct 17 15:08:38 1996 +0200
+++ b/ObjFHandle.st	Fri Oct 18 14:35:41 1996 +0200
@@ -176,6 +176,14 @@
 update:something with:aParameter from:changedObject
     "my method/class object was collected - unload the underlying objectfile"
 
+    something == weakMethodRef ifTrue:[
+	weakMethodRef nilAllCorpsesAndDo:[:idx |].
+    ].
+
+    something == weakClassRefs ifTrue:[
+	weakClassRefs nilAllCorpsesAndDo:[:idx |].
+    ].
+
     self isObsolete ifTrue:[
 	('OBJFLOADER: unloading ' , pathName , '  (method/classes were garbageCollected)') infoPrintNL.
 	ObjectFileLoader unloadObjectFile:pathName
@@ -252,6 +260,9 @@
     f setName:aString moduleHandle:self.
 
     slot := weakFunctionRefs identityIndexOf:nil.
+    slot == 0 ifTrue:[
+	slot := weakFunctionRefs identityIndexOf:0
+    ].
     slot ~~ 0 ifTrue:[
         weakFunctionRefs at:slot put:f.
         ^ f.
@@ -288,14 +299,17 @@
 isForCollectedObject
     "return true, if my clases/method has already been garbage collected"
 
+    |ref|
+
     handleType == #classLibraryObject ifTrue:[
-        ^ (weakClassRefs findFirst:[:x | x notNil]) == 0
+        ^ (weakClassRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0
     ].
     handleType == #methodObject ifTrue:[
-        ^ (weakMethodRef at:1) isNil
+	ref := weakMethodRef at:1.
+        ^ ref isNil or:[ref == 0]
     ].
     handleType == #functionObject ifTrue:[
-        ^ (weakFunctionRefs findFirst:[:x | x notNil]) == 0
+        ^ (weakFunctionRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0
     ].
 
     ^ false
@@ -323,15 +337,18 @@
     "return true, if my clases/method has already been removed from
      the image. I.e. if the object file can be unloaded without danger."
 
+    |ref|
+
     moduleID notNil ifTrue:[
         handleType == #classLibraryObject ifTrue:[
-            ^ (weakClassRefs findFirst:[:x | x notNil]) == 0
+            ^ (weakClassRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0
         ].
         handleType == #methodObject ifTrue:[
-            ^ (weakMethodRef at:1) isNil
+	    ref := weakMethodRef at:1.
+            ^ (ref isNil or:[ref == 0])
         ].
         handleType == #functionObject ifTrue:[
-            ^ (weakFunctionRefs findFirst:[:x | x notNil]) == 0
+            ^ (weakFunctionRefs findFirst:[:x | x notNil and:[x ~~ 0]]) == 0
         ].
     ].
     ^ false
@@ -342,5 +359,5 @@
 !ObjectFileHandle  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFHandle.st,v 1.17 1996-07-12 15:25:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFHandle.st,v 1.18 1996-10-18 12:35:41 cg Exp $'
 ! !