Kaydet (Commit) 81ec6912 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

CWS-TOOLING: integrate CWS i93512_DEV300

üst fb9fea37
......@@ -383,9 +383,37 @@ static const struct ExceptionalKey
return mpFrame ? (mpFrame->getClipPath() != 0 ? NO : YES) : YES;
}
// helper class similar to a vos::OGuard for the SalYieldMutex
// the difference is that it only does tryToAcquire instead of aquire
// so dreaded deadlocks like #i93512# are prevented
class TryGuard
{
public:
TryGuard() { mbGuarded = ImplSalYieldMutexTryToAcquire(); }
~TryGuard() { if( mbGuarded ) ImplSalYieldMutexRelease(); }
bool IsGuarded() { return mbGuarded; }
private:
bool mbGuarded;
};
-(void)drawRect: (NSRect)aRect
{
YIELD_GUARD;
// HOTFIX: #i93512# prevent deadlocks if any other thread already has the SalYieldMutex
TryGuard aTryGuard;
if( !aTryGuard.IsGuarded() )
{
// NOTE: the mpFrame access below is not guarded yet!
// TODO: mpFrame et al need to be guarded by an independent mutex
AquaSalGraphics* pGraphics = (mpFrame && AquaSalFrame::isAlive(mpFrame)) ? mpFrame->mpGraphics : NULL;
if( pGraphics )
{
// we did not get the mutex so we cannot draw now => request to redraw later
// convert the NSRect to a CGRect for Refreshrect()
const CGRect aCGRect = {{aRect.origin.x,aRect.origin.y},{aRect.size.width,aRect.size.height}};
pGraphics->RefreshRect( aCGRect );
}
return;
}
if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
{
......@@ -395,7 +423,6 @@ static const struct ExceptionalKey
if( mpFrame->getClipPath() )
[mpFrame->getWindow() invalidateShadow];
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment