pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

SpMorphicBoxAdapter>>#remove: can crash #1466

Open jecisc opened 10 months ago

jecisc commented 10 months ago

In Pharo CI we have a lot of crashes due to rendering errors. Recently we removed an #on:do: that was preventing us to get the debug stack logged and we found out that one place we get this error is in SpMorphicBoxAdapter.

#widget was sent to nil
UndefinedObject(Object)>>doesNotUnderstand: #widget
SpMorphicBoxAdapter>>remove:
[ :ann |
        self remove: ann child ] in SpMorphicBoxAdapter>>layout: in Block: [ :ann |...
FullBlockClosure(BlockClosure)>>cull:
FullBlockClosure(BlockClosure)>>cull:cull:
[ action cull: anAnnouncement cull: announcer ] inAnnouncementSubscription(AbstractAnnouncementSubscription)>>deliver:in Block: [ action cull: anAnnouncement cull: announcer ]
FullBlockClosure(BlockClosure)>>on:do:
[ Processor terminateRealActive ] in [ :ex |
              | onDoCtx handler bottom thisCtx |
              onDoCtx := thisContext.
              thisCtx := onDoCtx home.

              "find the context on stack for which this method's is sender"
              [ onDoCtx sender == thisCtx ] whileFalse: [
                  onDoCtx := onDoCtx sender.
                  onDoCtx ifNil: [ "Can't find our home context. seems like we're already forked
                and handling another exception in new thread. In this case, just pass it through handler."
                      ^ handlerAction cull: ex ] ].

              bottom := [ Processor terminateRealActive ] asContext.
              onDoCtx privSender: bottom.
              handler := [ handlerAction cull: ex ] asContext.
              handler privSender: thisContext sender.

              (Process forContext: handler priority: Processor activePriority) resume.
              "cut the stack of current process"
              thisContext privSender: thisCtx.
              nil ] in FullBlockClosure(BlockClosure)>>on:fork: in Block: [ Processor terminateRealActive ]