Weird behavior where writing to an instance variable overwrites another instance variable instead

Yar Hwee Boon hboon at motionobj.com
Wed Oct 13 11:12:12 UTC 2004


I'm getting a very weird behavior. Using Seaside, I have a method as below:

ACTransactionEditor>>addValidationError: aString
	validationErrors
		ifNil: [validationErrors := OrderedCollection new].
	^ validationErrors add: aString

ACTransactionEditor (a subclass of WAEditDialog, for those who use  
Seaside), inherits the instance variable "decoration" from a superclass. I  
define a instance variable called validationErrors. In the 3rd line of  
#addValidationError:, the assignment to validationErrors actually assigns  
to decoration instead, leaving validationErrors unchanged. I went through  
the debugger a couple of times and can swear to it happening. It finally  
work snormally after I put a self halt into #addValidationError:. After  
that, removing the self halt, etc, the code still works (ie. I can't  
reproduce it anymore).

Does anyone know what happened? Thanks.

-- 
Regards
HweeBoon
MotionObj



More information about the Squeak-dev mailing list