summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-09-26 12:42:43 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-09-26 12:42:43 +0000
commit81ec69125209a2f363c1c750962ff2bfa880b7cf (patch)
tree82b6e87943da3f037807b37315208b3f3f77ba59
parentfb9fea37f171a1c0430a4b64f7c465c3c668c632 (diff)
CWS-TOOLING: integrate CWS i93512_DEV300
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm31
1 files changed, 29 insertions, 2 deletions
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index f74a7894aeca..e0a538b16cee 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -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];
}
-
}
}