--- a/DeviceWorkstation.st Tue Oct 10 16:58:52 2006 +0200
+++ b/DeviceWorkstation.st Tue Oct 10 16:59:01 2006 +0200
@@ -9,7 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
"{ Package: 'stx:libview' }"
HostGraphicsDevice subclass:#DeviceWorkstation
@@ -579,9 +578,9 @@
"an error in the devices low level code (typically Xlib or XtLib)
This is invoked via
- XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers
+ XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers
or
- XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers
+ XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers
looks if a signal handler for DeviceErrorSignal is present,
and - if so raises the signal.
@@ -593,20 +592,20 @@
|badResource msg theDevice theSignal p signalHolder|
errID notNil ifTrue:[
- "/
- "/ timeoutError passes the device;
- "/ the others pass the devicesID
- "/
- errID == #DisplayIOTimeoutError ifTrue:[
- theDevice := aParameter.
- "/ 'device timeout error' printCR.
- ] ifFalse:[
- AllScreens do:[:aDisplayDevice |
- aDisplayDevice id = aParameter ifTrue:[
- theDevice := aDisplayDevice.
- ]
- ]
- ]
+ "/
+ "/ timeoutError passes the device;
+ "/ the others pass the devicesID
+ "/
+ errID == #DisplayIOTimeoutError ifTrue:[
+ theDevice := aParameter.
+ "/ 'device timeout error' printCR.
+ ] ifFalse:[
+ AllScreens do:[:aDisplayDevice |
+ aDisplayDevice id = aParameter ifTrue:[
+ theDevice := aDisplayDevice.
+ ]
+ ]
+ ]
].
"/ now, we have the bad guy at hand ...
@@ -614,24 +613,24 @@
signalHolder := theDevice ? self.
errID == #DisplayIOError ifTrue:[
- "always raises an exception"
- theSignal := signalHolder deviceIOErrorSignal.
- msg := 'Display I/O Error'.
- badResource := theDevice.
+ "always raises an exception"
+ theSignal := signalHolder deviceIOErrorSignal.
+ msg := 'Display I/O Error'.
+ badResource := theDevice.
] ifFalse:[errID == #DisplayIOTimeoutError ifTrue:[
- "always raises an exception for the current process"
- theSignal := signalHolder deviceIOTimeoutErrorSignal.
- msg := 'Display I/O timeout Error'.
- badResource := theDevice.
+ "always raises an exception for the current process"
+ theSignal := signalHolder deviceIOTimeoutErrorSignal.
+ msg := 'Display I/O timeout Error'.
+ badResource := theDevice.
] ifFalse:[ "errID == #DisplayError"
- "only raises an exception if handled"
- theSignal := signalHolder deviceErrorSignal.
- theDevice notNil ifTrue:[
- "/ #resourceIdOfLastError will become instance-specific information in
- "/ the near future ...
- badResource := theDevice resourceOfId:self resourceIdOfLastError.
- ].
- msg := 'Display error: ' , self lastErrorString.
+ "only raises an exception if handled"
+ theSignal := signalHolder deviceErrorSignal.
+ theDevice notNil ifTrue:[
+ "/ #resourceIdOfLastError will become instance-specific information in
+ "/ the near future ...
+ badResource := theDevice resourceOfId:self resourceIdOfLastError.
+ ].
+ msg := 'Display error: ' , self lastErrorString.
]].
'DeviceWorkstation [info]: ' infoPrint. msg infoPrint. ' - ' infoPrint. badResource infoPrintCR.
@@ -643,60 +642,74 @@
that caused the timeout."
(errID ~~ #DisplayIOTimeoutError and:[theDevice notNil]) ifTrue:[
- p := theDevice dispatchProcess.
- (p notNil and:[p ~~ Processor activeProcess]) ifTrue:[
- 'DeviceWorkstation [info]: interrupting: ' infoPrint. p infoPrintCR.
- p interruptWith:[
- (errID == #DisplayError and:[theSignal isHandled not]) ifTrue:[
- "unhandled display errors are ignored"
- ErrorPrinting ifTrue:[
- ('DeviceWorkstation [error]: ' , msg) errorPrintCR
- ].
- ] ifFalse:[
- 'DeviceWorkstation [info]: raising exception ...' infoPrintCR.
- theSignal raiseSignalWith:badResource errorString:msg.
- 'DeviceWorkstation [warning]: exception returned - send brokenConnection' errorPrintCR.
- theDevice brokenConnection.
- 'DeviceWorkstation [warning]: stopping dispatch' errorPrintCR.
- theDevice stopDispatch.
- ].
- ].
- ^ self.
+ p := theDevice dispatchProcess.
+ (p notNil and:[p ~~ Processor activeProcess]) ifTrue:[
+ 'DeviceWorkstation [info]: interrupting: ' infoPrint. p infoPrintCR.
+ p interruptWith:[
+ (errID == #DisplayError and:[theSignal isHandled not]) ifTrue:[
+ "unhandled display errors are ignored"
+ ErrorPrinting ifTrue:[
+ ('DeviceWorkstation [error]: ' , msg) errorPrintCR
+ ].
+ ] ifFalse:[
+ 'DeviceWorkstation [info]: raising exception ...' infoPrintCR.
+ theSignal raiseSignalWith:badResource errorString:msg.
+ 'DeviceWorkstation [warning]: exception returned - send brokenConnection' errorPrintCR.
+ theDevice brokenConnection.
+ 'DeviceWorkstation [warning]: stopping dispatch' errorPrintCR.
+ theDevice stopDispatch.
+ ].
+ ].
+ ^ self.
"/ Processor reschedule.
"/ AbortOperationRequest raise.
- ].
+ ].
].
"If we come here, this is a DiplayIOTimeoutError, we don't know
the display device or we are running on top of the dispatchProcess"
(theSignal isHandled or:[theSignal handlerBlock notNil]) ifTrue:[
- 'DeviceWorkstation [info]: raising signal in current process' infoPrintCR.
+ 'DeviceWorkstation [info]: raising signal in current process' infoPrintCR.
"/ Processor activeProcess displayString infoPrintCR.
- theSignal raiseSignalWith:badResource errorString:msg.
+ theSignal raiseSignalWith:badResource errorString:msg.
].
errID == #DisplayError ifTrue:[
- "unhandled display errors are ignored"
- ^ self.
+ "unhandled display errors are ignored"
+ ^ self.
].
theDevice notNil ifTrue:[
- 'DeviceWorkstation [info]: sending #brokenConnection' infoPrintCR.
- theDevice brokenConnection.
- theDevice dispatchProcess == Processor activeProcess ifTrue:[
- "I am running in the dispatch process
- and nobody handles theSignal, so abort the dispatcher"
-
- 'DeviceWorkstation [info]: raising AbortOperationRequest' infoPrintCR.
- AbortOperationRequest raise.
- ] ifFalse:[
- "Some other process (probably not even guilty - like someone doing a draw after a change) ...
- ... see if we can unwind out of the drawing operation"
-
- 'DeviceWorkstation [info]: should unwind the draw operation' infoPrintCR.
- thisContext fullPrintAll.
- ]
+ 'DeviceWorkstation [info]: sending #brokenConnection' infoPrintCR.
+ theDevice brokenConnection.
+ theDevice dispatchProcess == Processor activeProcess ifTrue:[
+ "I am running in the dispatch process
+ and nobody handles theSignal, so abort the dispatcher"
+
+ 'DeviceWorkstation [info]: raising AbortOperationRequest' infoPrintCR.
+ AbortOperationRequest raise.
+ ] ifFalse:[
+ "Some other process (probably not even guilty - like someone doing a draw after a change) ...
+ ... see if we can unwind out of the drawing operation"
+
+ |context|
+
+"/ thisContext fullPrintAll.
+ context := thisContext.
+ [
+ "find the first returnable context where theDevice is the receiver"
+ context := context sender.
+ ] doUntil:[
+ context isNil or:[context receiver == theDevice and:[context canReturn]].
+ ].
+ context notNil ifTrue:[
+ 'DeviceWorkstation [info]: unwind the draw operation' infoPrintCR.
+"/ context fullPrintAll.
+ context unwind.
+ "not reached"
+ ].
+ ]
].
'DeviceWorkstation [info]: proceeding after error' infoPrintCR.
@@ -7621,7 +7634,7 @@
!DeviceWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.502 2006-09-29 11:06:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.503 2006-10-10 14:59:01 stefan Exp $'
! !
DeviceWorkstation initialize!