[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Tue Oct 19 19:33:42 CEST 2004
CVS commit by staikos:
remove race from kstdebug - you will need to make sure that debugdialog.o is
rebuilt or you will see crashes after updating
M +18 -16 kstdebug.cpp 1.12
M +5 -5 kstdebug.h 1.11
--- kdeextragear-2/kst/kst/kstdebug.cpp #1.11:1.12
@@ -25,4 +25,6 @@
static KStaticDeleter<KstDebug> sd;
+KstDebug *KstDebug::_self = 0L;
+
KstDebug *KstDebug::self() {
if (!_self) {
@@ -41,5 +45,4 @@ KstDebug::~KstDebug() {
}
-KstDebug *KstDebug::_self = 0L;
QStringList KstDebug::dataSourcePlugins() const {
@@ -47,5 +50,7 @@ QStringList KstDebug::dataSourcePlugins(
}
+
void KstDebug::log(const QString& msg, LogLevel level) {
+ QMutexLocker ml(&_lock);
LogMessage message;
@@ -73,4 +78,5 @@ void KstDebug::log(const QString& msg, L
void KstDebug::clear() {
+ QMutexLocker ml(&_lock);
_messages.clear();
}
@@ -78,28 +84,21 @@ void KstDebug::clear() {
QString KstDebug::label(LogLevel level) const {
- QString str;
-
switch (level) {
case Notice:
- str = i18n("Notice");
- break;
+ return i18n("Notice");
case Warning:
- str = i18n("Warning");
- break;
+ return i18n("Warning");
case Error:
- str = i18n("Error");
- break;
+ return i18n("Error");
case Debug:
- str = i18n("Debug");
- break;
+ return i18n("Debug");
default:
- str = i18n("Other");
- break;
+ return i18n("Other");
}
-
- return str;
}
-QString KstDebug::text() const {
+
+QString KstDebug::text() {
+ QMutexLocker ml(&_lock);
// FIXME: this must be hard to internationalize
QString body = i18n("Kst version %1\n\n\nKst log:\n").arg(KSTVERSION);
@@ -119,5 +118,7 @@ QString KstDebug::text() const {
}
+
void KstDebug::setLimit(bool applyLimit, int limit) {
+ QMutexLocker ml(&_lock);
_applyLimit = applyLimit;
_limit = limit;
--- kdeextragear-2/kst/kst/kstdebug.h #1.10:1.11
@@ -19,6 +19,7 @@
#define KSTDEBUG_H
-#include <qobject.h>
#include <qdatetime.h>
+#include <qobject.h>
+#include <qmutex.h>
#include <kstaticdeleter.h>
@@ -41,8 +40,8 @@ class KstDebug : public QObject {
void log(const QString& msg, LogLevel level = Notice);
void setLimit(bool applyLimit, int limit);
- QString text() const;
+ QString text();
void sendEmail();
- const QValueList<LogMessage>& messages() { return _messages; }
+ const QValueList<LogMessage>& messages() const { return _messages; }
QStringList dataSourcePlugins() const;
QString label(LogLevel level) const;
@@ -59,4 +58,5 @@ class KstDebug : public QObject {
bool _applyLimit;
int _limit;
+ QMutex _lock;
};
More information about the Kst
mailing list