AbortAllOperationRequest.st
author Jan Vrany <jan.vrany@labware.com>
Thu, 25 Mar 2021 20:30:03 +0000
branchjv
changeset 25411 248600ba8fd9
parent 18017 7fef9e17913f
permissions -rw-r--r--
Fix unlikely but possible race in `WeakValueDictionary` It may happen that value in `valueArray` could have been already collected by the GC but #clearDeadSlots have not yet been called. When this happened, `#at:ifAbsentPut:` returned tombstone rather than updating the dictionary with value from block. This commit fixes this by checking whether `valueArray` contain the tombstone and if so, clearing up the dead slots and restarting the operation. HTH.

"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic' }"

ControlRequest subclass:#AbortAllOperationRequest
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Exceptions-Control'
!

!AbortAllOperationRequest class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Raised by some dialogs 'Cancel All' button.

    If unhandled, this is equivalent to raising the AbortOperationRequest.
    However, some applications catch this signal when performing an operation
    on multiple objects (such as a fileBrowser, when deleting multiple files).
    In these situations, Abort is typically caught to cancel a single
    operation, while AbortAll is used to cancel the whole action.
"
! !

!AbortAllOperationRequest class methodsFor:'initialization'!

initialize

    NotifierString := 'abort all operations requested'.

    "
     self initialize
    "
! !

!AbortAllOperationRequest class methodsFor:'special handling'!

handleAndAnswerQueryIn:aBlock
    "evaluate aBlock, and return immediately, if the AbortAllRequest is raised.
     Answer any query if AllOperationWanted with true."

    self handle:[:ex |
    ] do:[
        AbortAllOperationWantedQuery 
            answer:true
            do:aBlock
    ].

    "
     AbortAllOperationRequest handleAndAnswerQueryIn:[
        AbortAllOperationWantedQuery query ifTrue:[
            self halt.
            AbortAllOperationRequest raise.
        ].
     ].
    "

    "Created: / 09-02-2011 / 13:58:01 / cg"
! !

!AbortAllOperationRequest class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/AbortAllOperationRequest.st,v 1.9 2013-01-24 15:24:00 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic/AbortAllOperationRequest.st,v 1.9 2013-01-24 15:24:00 cg Exp $'
! !


AbortAllOperationRequest initialize!