A new version of Kernel was added to project The Inbox: http://source.squeak.org/inbox/Kernel-jar.1555.mcz
==================== Summary ====================
Name: Kernel-jar.1555 Author: jar Time: 2 February 2024, 10:28:00.518051 pm UUID: 2b2e05af-0a76-dd48-ac77-04c73f5dbda0 Ancestors: Kernel-mt.1551
apply a similar modification that was applied to #contextEnsure: in Kernel-jar.1553
=============== Diff against Kernel-mt.1551 ===============
Item was changed: ----- Method: Context class>>contextOn:do: (in category 'special context creation') ----- contextOn: exceptionClass do: block "Create an #on:do: context that is ready to return from executing its receiver. As ctxt is *not* a top context as required by #jump, we need to put a (fake) return value (nil) on its stack. Otherwise, #jump will pop something different from the stack. Concretely, this caused the bug described in [1] (Scenario 1) because the latest stack top was the closure vector {chain}. This closure vector was accidently popped away so that in the final return statement, #pushRemoteTemp:inVectorAt: raised an error subscript bounds (because the next stack item was not variable). Read the linked bug report for more details.
[1] http://forum.world.st/BUG-s-in-Context-control-jump-runUntilErrorOrReturnFro..."
| ctxt chain | ctxt := thisContext. + [chain := thisContext sender. - [chain := thisContext sender cut: ctxt. ctxt push: nil. "fake return value" ctxt jump] on: exceptionClass do: block. "jump above will resume here without unwinding chain" + ^ chain privSender: nil + "nil chain's sender after the jump rather than before to prevent unwind failure during termination, see bug report [2]: + + [2] https://github.com/squeak-smalltalk/squeak-object-memory/issues/112%22! - ^ chain!
squeak-dev@lists.squeakfoundation.org