The Trunk: Morphic-mt.1258.mcz

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

The Trunk: Morphic-mt.1258.mcz

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

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

Name: Morphic-mt.1258
Author: mt
Time: 11 August 2016, 3:18:11.232564 pm
UUID: 28b5290d-2a7d-3844-855c-c122f0e0edc7
Ancestors: Morphic-mt.1257

Fixes a serious regression where the emergency evaluator appeared way too often for even simple drawing errors. New strategy: Try to repaint the world, remembering all errors for various kinds of receivers. Since bad morphs get flagged, this loop terminates. After that, show debuggers for all kinds of errors that appeared. This makes working in Morphic more robust and you can be sure that, after debuggers appear, all drawing glitches have been taken care of.

=============== Diff against Morphic-mt.1257 ===============

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 errors previousClasses |
+ finished := false.
+ errors := nil.
+
+ [finished] whileFalse: [
+ [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 handleFatalDrawingError: 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."
+ errors ifNil: [errors := OrderedCollection new].
+ previousClasses ifNil: [previousClasses := IdentitySet new].
+ (previousClasses includes: rcvr class) ifFalse: [
+ previousClasses add: rcvr class.
+ errors add: (Process forContext: ex signalerContext copyStack priority: Processor activeProcess priority) -> err].
+ aWorld fullRepaintNeeded.
+ ]].
+
+ "Open debuggers for all different errors found."
+ errors ifNotNil: [
+ [errors do: [:ea |
+ (Debugger new process: ea key controller: nil context: ea key suspendedContext)
+ errorWasInUIProcess: Processor activeProcess = Project current uiProcess;
+ openNotifierContents: nil label: ea value].
+ "Try to draw the debuggers or else there will be no chance to escape from this catch-drawing-error loop."
+ ActiveWorld displayWorld] on: Error do: [:ex | Project current handleFatalDrawingError: ex description] ].!
- [aWorld displayWorld] ifError: [:err :rcvr |
- "Handle a drawing error"
- | errCtx errMorph |
- 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 handleFatalDrawingError: 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.
- "Install the old error handler, so we can re-raise the error"
- rcvr error: err.
- ].!