The Trunk: Morphic-mt.1575.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1575.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1575.mcz

==================== Summary ====================

Name: Morphic-mt.1575
Author: mt
Time: 15 October 2019, 1:30:24.148785 pm
UUID: c7bde074-ddad-864a-a5b3-8b078736fe2f
Ancestors: Morphic-mt.1574

More robustness: (1) Catch both Error and Halt in Morphic drawing and (2) Reset drawing errors in morphs when restoring the Display.

=============== Diff against Morphic-mt.1574 ===============

Item was added:
+ ----- Method: MorphicProject>>restoreDisplay (in category 'scheduling & debugging') -----
+ restoreDisplay
+ "Give all morphs a chance to draw again."
+ self world ifNotNil: [:w | w allMorphsDo: [:ea | ea removeProperty: #errorOnDraw ]].
+
+ super restoreDisplay.!

Item was changed:
  ----- Method: WorldState>>displayWorldSafely: (in category 'update cycle') -----
  displayWorldSafely: aWorld
  "Update this world's display and keep track of errors during draw methods."
 
  | finished classesWithErrors |
  finished := false.
 
  [finished] whileFalse: [
+ [aWorld displayWorld. finished := true] on: Error, Halt do: [:ex |
- [aWorld displayWorld. finished := true] on: Error do: [:ex |
  "Handle a drawing error"
  | err rcvr errCtx errMorph |
  err := ex description.
  rcvr := ex receiver.
 
  errCtx := thisContext.
  [
  errCtx := errCtx sender.
  "Search the sender chain to find the morph causing the problem"
  [errCtx notNil and:[(errCtx receiver isMorph) not]]
  whileTrue:[errCtx := errCtx sender].
  "If we're at the root of the context chain then we have a fatal drawing problem"
  errCtx ifNil:[^Project current fatalDrawingError: err].
  errMorph := errCtx receiver.
  "If the morph causing the problem has already the #drawError flag set,
  then search for the next morph above in the caller chain."
  errMorph hasProperty: #errorOnDraw
  ] whileTrue.
  errMorph setProperty: #errorOnDraw toValue: true.
 
  "Catch all errors, one for each receiver class."
  classesWithErrors ifNil: [classesWithErrors := IdentitySet new].
  (classesWithErrors includes: rcvr class) ifFalse: [
  classesWithErrors add: rcvr class.
  ToolSet debugException: ex].
 
  "Repaint all to catch all errors now and not if the debugger will appear."
  aWorld fullRepaintNeeded.
  ]].!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1575.mcz

Hannes Hirzel
Hi Marcel

With this fix you did here, this test now passes

1. Image Squeak5.3alpha latest update: #19124
2. Put a 'self halt' into the LazyListMorph >> #drawOn: method
3. The lists get red with a yellow X in the System Brower.
4. Ctrl plus stop brings you into an MVC project where you can revert
the 'self halt'
5. Jump back to the original project.

Result: The Morphic project is fixed after an error which caused the
GUI to stop.

Regards
Hannes

On Tue, 15 Oct 2019 11:30:30 0000, [hidden email]
<[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1575.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1575
> Author: mt
> Time: 15 October 2019, 1:30:24.148785 pm
> UUID: c7bde074-ddad-864a-a5b3-8b078736fe2f
> Ancestors: Morphic-mt.1574
>
> More robustness: (1) Catch both Error and Halt in Morphic drawing and (2)
> Reset drawing errors in morphs when restoring the Display.
>
> =============== Diff against Morphic-mt.1574 ===============
>
> Item was added:
> + ----- Method: MorphicProject>>restoreDisplay (in category 'scheduling &
> debugging') -----
> + restoreDisplay
> + "Give all morphs a chance to draw again."
> + self world ifNotNil: [:w | w allMorphsDo: [:ea | ea removeProperty:
> #errorOnDraw ]].
> +
> + super restoreDisplay.!
>
> Item was changed:
>   ----- Method: WorldState>>displayWorldSafely: (in category 'update cycle')
> -----
>   displayWorldSafely: aWorld
>   "Update this world's display and keep track of errors during draw
> methods."
>
>   | finished classesWithErrors |
>   finished := false.
>  
>   [finished] whileFalse: [
> + [aWorld displayWorld. finished := true] on: Error, Halt do: [:ex |
> - [aWorld displayWorld. finished := true] on: Error do: [:ex |
>   "Handle a drawing error"
>   | err rcvr errCtx errMorph |
>   err := ex description.
>   rcvr := ex receiver.
>
>   errCtx := thisContext.
>   [
>   errCtx := errCtx sender.
>   "Search the sender chain to find the morph causing the problem"
>   [errCtx notNil and:[(errCtx receiver isMorph) not]]
>   whileTrue:[errCtx := errCtx sender].
>   "If we're at the root of the context chain then we have a fatal
> drawing problem"
>   errCtx ifNil:[^Project current fatalDrawingError: err].
>   errMorph := errCtx receiver.
>   "If the morph causing the problem has already the #drawError flag set,
>   then search for the next morph above in the caller chain."
>   errMorph hasProperty: #errorOnDraw
>   ] whileTrue.
>   errMorph setProperty: #errorOnDraw toValue: true.
>
>   "Catch all errors, one for each receiver class."
>   classesWithErrors ifNil: [classesWithErrors := IdentitySet new].
>   (classesWithErrors includes: rcvr class) ifFalse: [
>   classesWithErrors add: rcvr class.
>   ToolSet debugException: ex].
>
>   "Repaint all to catch all errors now and not if the debugger will
> appear."
>   aWorld fullRepaintNeeded.
>   ]].!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1575.mcz

marcel.taeumel
4. Ctrl plus stop brings you into an MVC project where you can revert
> the 'self halt'

That's a bug. :-D MVC should be entered automatically. There might be an issue in Project >> #enterForEmergencyRecovery.

Best,
Marcel

Am 15.10.2019 13:49:48 schrieb H. Hirzel <[hidden email]>:

Hi Marcel

With this fix you did here, this test now passes

1. Image Squeak5.3alpha latest update: #19124
2. Put a 'self halt' into the LazyListMorph >> #drawOn: method
3. The lists get red with a yellow X in the System Brower.
4. Ctrl plus stop brings you into an MVC project where you can revert
the 'self halt'
5. Jump back to the original project.

Result: The Morphic project is fixed after an error which caused the
GUI to stop.

Regards
Hannes

On Tue, 15 Oct 2019 11:30:30 0000, [hidden email]
wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1575.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1575
> Author: mt
> Time: 15 October 2019, 1:30:24.148785 pm
> UUID: c7bde074-ddad-864a-a5b3-8b078736fe2f
> Ancestors: Morphic-mt.1574
>
> More robustness: (1) Catch both Error and Halt in Morphic drawing and (2)
> Reset drawing errors in morphs when restoring the Display.
>
> =============== Diff against Morphic-mt.1574 ===============
>
> Item was added:
> + ----- Method: MorphicProject>>restoreDisplay (in category 'scheduling &
> debugging') -----
> + restoreDisplay
> + "Give all morphs a chance to draw again."
> + self world ifNotNil: [:w | w allMorphsDo: [:ea | ea removeProperty:
> #errorOnDraw ]].
> +
> + super restoreDisplay.!
>
> Item was changed:
> ----- Method: WorldState>>displayWorldSafely: (in category 'update cycle')
> -----
> displayWorldSafely: aWorld
> "Update this world's display and keep track of errors during draw
> methods."
>
> | finished classesWithErrors |
> finished := false.
>
> [finished] whileFalse: [
> + [aWorld displayWorld. finished := true] on: Error, Halt do: [:ex |
> - [aWorld displayWorld. finished := true] on: Error do: [:ex |
> "Handle a drawing error"
> | err rcvr errCtx errMorph |
> err := ex description.
> rcvr := ex receiver.
>
> errCtx := thisContext.
> [
> errCtx := errCtx sender.
> "Search the sender chain to find the morph causing the problem"
> [errCtx notNil and:[(errCtx receiver isMorph) not]]
> whileTrue:[errCtx := errCtx sender].
> "If we're at the root of the context chain then we have a fatal
> drawing problem"
> errCtx ifNil:[^Project current fatalDrawingError: err].
> errMorph := errCtx receiver.
> "If the morph causing the problem has already the #drawError flag set,
> then search for the next morph above in the caller chain."
> errMorph hasProperty: #errorOnDraw
> ] whileTrue.
> errMorph setProperty: #errorOnDraw toValue: true.
>
> "Catch all errors, one for each receiver class."
> classesWithErrors ifNil: [classesWithErrors := IdentitySet new].
> (classesWithErrors includes: rcvr class) ifFalse: [
> classesWithErrors add: rcvr class.
> ToolSet debugException: ex].
>
> "Repaint all to catch all errors now and not if the debugger will
> appear."
> aWorld fullRepaintNeeded.
> ]].!
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1575.mcz

Balázs Kósi
In reply to this post by commits-2
Hi Marcel!

Thanks for the fix! I would be inclined to cache the Error, Halt ExceptionSet somewhere (e.g. in a class var) instead of creating it repeatedly in a tight loop (called every ~20ms), but it may not worth the extra complexity. (Costs 100ns on my machine, and creates at least 3 new objects, which may or may not leave new space*)

Balázs

* Is there a way to record what happens to a particular object regarding garbage collection?