--- a/ObjectFileHandle.st Wed Apr 14 15:41:29 2010 +0200
+++ b/ObjectFileHandle.st Fri Apr 16 19:14:05 2010 +0200
@@ -74,9 +74,16 @@
classes:aCollectionOfClasses
"set the classes collection"
- weakClassRefs := WeakArray withAll:aCollectionOfClasses.
- weakClassRefs addDependent:self.
- handleType := #classLibraryObject
+ weakClassRefs notNil ifTrue:[
+ weakClassRefs removeDependent:self.
+ weakClassRefs := nil.
+ handleType := nil.
+ ].
+ aCollectionOfClasses notNil ifTrue:[
+ weakClassRefs := WeakArray withAll:aCollectionOfClasses.
+ weakClassRefs addDependent:self.
+ handleType := #classLibraryObject
+ ].
"Created: 14.9.1995 / 21:13:13 / claus"
!
@@ -113,9 +120,16 @@
method:something
"set the method"
- weakMethodRef := WeakArray with:something.
- weakMethodRef addDependent:self.
- handleType := #methodObject.
+ weakMethodRef notNil ifTrue:[
+ weakMethodRef removeDependent:self.
+ weakMethodRef := nil.
+ handleType := nil.
+ ].
+ something notNil ifTrue:[
+ weakMethodRef := WeakArray with:something.
+ weakMethodRef addDependent:self.
+ handleType := #methodObject.
+ ].
"Created: 14.9.1995 / 21:13:13 / claus"
!
@@ -210,6 +224,33 @@
!ObjectFileHandle methodsFor:'actions'!
+removeConnectedObjects
+ "remove the smalltalk objects from the system that are connected
+ with this ObjectFileHandle"
+
+ |method|
+
+ self isClassLibHandle ifTrue:[
+ "/ remove the classes ...
+ Class withoutUpdatingChangesDo:[
+ self classes do:[:eachClass |
+ (eachClass notNil and:[eachClass isMeta not]) ifTrue:[
+ eachClass removeFromSystem.
+ ]
+ ]
+ ].
+ ^ self.
+ ].
+ self isMethodHandle ifTrue:[
+ "we keep the method, but break the association to its code"
+ method := self method.
+ method notNil ifTrue:[
+ method code:nil.
+ self method:nil.
+ ].
+ ].
+!
+
unload
"unload the object file represented by me"
@@ -243,7 +284,7 @@
weakMethodRef := nil.
].
('ObjectFileHandle [info]: unloading ' , pathName , ' (method/classes were garbageCollected)') infoPrintCR.
- ObjectFileLoader unloadObjectFile:pathName.
+ self unload.
snapshot == true ifFalse:[
"This object file has never been saved in a snapshot,
so it can be savely removed"
@@ -464,5 +505,9 @@
!ObjectFileHandle class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.36 2006-10-12 18:15:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.37 2010-04-16 17:14:05 stefan Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileHandle.st,v 1.37 2010-04-16 17:14:05 stefan Exp $'
! !