summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-17 23:28:44 +0200
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2018-06-24 20:31:14 +0200
commitdb0dd54c376eb25263059075e5103f0849ef2ffe (patch)
treec09508b373812d440aca2149e40e98612ffe291e /desktop-widgets/mainwindow.cpp
parent879cb73b8bda364f63cc97c0f9963cfddc581add (diff)
downloadsubsurface-db0dd54c376eb25263059075e5103f0849ef2ffe.tar.gz
Localization: make cache thread safe and robust against use-after-free
The old trGettext() was not thread-safe and the returned C-strings could be freed in the case of empty translations strings. Therefore: 1) Introduce a mutex protecting access to the cache. 2) Never change existing entries, even if the translation string is empty. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 95efcca63..b22b7e265 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -14,6 +14,7 @@
#include <QToolBar>
#include <QStatusBar>
+#include "core/gettextfromc.h"
#include "core/version.h"
#include "core/subsurface-string.h"
#include "desktop-widgets/divelistview.h"