From cf550035dde7a9efe7f26dbcbba39a3d62926387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 2 Nov 2005 14:37:17 +0000 Subject: [PATCH] This works around a deadlock that frequently happened when working with menus (font stuff). I should start investigate this one more deeply some time... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14646 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerApp.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 8865efcb7b..7070ed245e 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -1343,15 +1343,19 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) font.SetSize(size); font.SetSpacing(spacing); - for (int32 i = 0; i < numStrings; i++) + for (int32 i = 0; i < numStrings; i++) { if (!stringArray[i] || lengthArray[i] <= 0) widthArray[i] = 0.0; - else - widthArray[i] = fDesktop->GetDisplayDriver()->StringWidth(stringArray[i], lengthArray[i], font); - // NOTE: The line below will return the exact same thing. However, - // the line above uses the AGG rendering backend, for which glyph caching - // actually works. It is about 20 times faster! - //width = font.StringWidth(string, length); + else { +// widthArray[i] = fDesktop->GetDisplayDriver()->StringWidth(stringArray[i], lengthArray[i], font); + // NOTE: The line below will return the exact same thing. However, + // the line above uses the AGG rendering backend, for which glyph caching + // actually works. It is about 20 times faster! + // TODO: I've disabled the AGG version for now, as it produces a dead lock + // (font use), that I am currently too lazy to investigate... + widthArray[i] = font.StringWidth(stringArray[i], lengthArray[i]); + } + } fLink.StartMessage(B_OK); fLink.Attach(widthArray, sizeof(widthArray));