squeak-smalltalk / squeak-object-memory

Issues and assets related to the Squeak object memory.
https://bugs.squeak.org
MIT License
11 stars 1 forks source link

Workspace acceptDroppingMorph was missing an assignment #118

Open jpenneygit opened 4 months ago

jpenneygit commented 4 months ago

I think I fixed it, the original on my image was missing the assignment (this is approximate, i didn't record the original code exactly):

(dropee isKindOf: TransferMorph)
    ifTrue: [reference := dropee passenger.
        externalName := dropee passenger className]
    ifFalse: [reference := dropee.
      ].

And instead just left externalName as nil, so when you got to "externalName := externalName isOctetString" it reported an unknown object.

I changed it to: (dropee isKindOf: TransferMorph) ifTrue: [reference := dropee passenger. externalName := dropee passenger className] ifFalse: [reference := dropee. externalName := dropee externalName].

(just adding the assignment to externalName)

This was a Squeak 5.1 32 bit image, You should be able to just look at the code and it's obviously wrong. If you want to reproduce, open a workspace, open any new morph with openInWorld, set the workspace to create textual references to dropped morphs, and drag and drop the morph on the workspace.

I'm trying to build a GUI, pretty much a beginner.

Here's the fixed code:


acceptDroppingMorph: dropee event: evt inMorph: targetMorph "Return the dropee to its old position, and add a reference to it at the cursor point." | bindingName externalName reference | (dropee isKindOf: TransferMorph) ifTrue: [reference := dropee passenger. externalName := dropee passenger className] ifFalse: [reference := dropee. externalName := dropee externalName]. externalName := externalName isOctetString ifTrue: [externalName] ifFalse: ['a' , externalName]. bindingName := externalName withFirstCharacterDownshifted , reference identityHash printString. targetMorph correctSelectionWithString: bindingName , ' '. (self bindingOf: bindingName) value: reference. (dropee isKindOf: TransferMorph) ifFalse: [dropee rejectDropMorphEvent: evt]. ^ true"success"