1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
$NetBSD: patch-bc,v 1.1 2009/10/11 08:13:40 markd Exp $
KDE svn 1032185
--- kdecore/localization/klocalizedstring.cpp.orig 2009-07-22 03:16:08.000000000 +1200
+++ kdecore/localization/klocalizedstring.cpp
@@ -24,6 +24,7 @@
#include <kglobal.h>
#include <kdebug.h>
#include <klocale.h>
+#include <klocale_p.h>
#include <kcomponentdata.h>
#include <klibrary.h>
#include <kstandarddirs.h>
@@ -126,8 +127,6 @@ class KLocalizedStringPrivateStatics
QHash<QString, KuitSemantics*> formatters;
- QMutex mutex;
-
KLocalizedStringPrivateStatics () :
theFence("|/|"),
startInterp("$["),
@@ -144,9 +143,7 @@ class KLocalizedStringPrivateStatics
translits(),
- formatters(),
-
- mutex(QMutex::Recursive)
+ formatters()
{}
~KLocalizedStringPrivateStatics ()
@@ -216,7 +213,7 @@ QString KLocalizedString::toString (cons
QString KLocalizedStringPrivate::toString (const KLocale *locale) const
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
// Assure the message has been supplied.
if (msg.isEmpty())
@@ -474,7 +471,7 @@ QString KLocalizedStringPrivate::postFor
const QString &ctxt) const
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
QString final = text;
@@ -499,7 +496,7 @@ QString KLocalizedStringPrivate::substit
bool &fallback) const
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
if (s->ktrs == NULL)
// Scripting engine not available.
@@ -564,7 +561,7 @@ int KLocalizedStringPrivate::resolveInte
// fallback is set to true if Transcript evaluation requested so.
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
result.clear();
fallback = false;
@@ -716,7 +713,7 @@ int KLocalizedStringPrivate::resolveInte
QVariant KLocalizedStringPrivate::segmentToValue (const QString &seg) const
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
// Return invalid variant if segment is either not a proper
// value reference, or the reference is out of bounds.
@@ -751,7 +748,7 @@ QString KLocalizedStringPrivate::postTra
const QString &final) const
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
if (s->ktrs == NULL)
// Scripting engine not available.
@@ -945,7 +942,7 @@ extern "C"
void KLocalizedStringPrivate::loadTranscript ()
{
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ QMutexLocker lock(kLocaleMutex());
s->loadTranscriptCalled = true;
s->ktrs = NULL; // null indicates that Transcript is not available
@@ -979,7 +976,8 @@ void KLocalizedStringPrivate::notifyCata
return;
}
KLocalizedStringPrivateStatics *s = staticsKLSP;
- QMutexLocker lock(&s->mutex);
+ // Very important: do not the mutex here.
+ //QMutexLocker lock(kLocaleMutex());
// Find script modules for all included language/catalogs that have them,
// and remember their paths.
|