mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2026-10-21 21:35:34 +00:00
add fix for possible race condition (#96)
This commit is contained in:
1 parent
75d101cc8b
commit
b20a96d32f
2 files changed
+17
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
|
||||||
|
index 1744fb7..f483209 100644
|
||||||
|
--- a/sources/awesome-widget/plugin/awkeys.cpp
|
||||||
|
+++ b/sources/awesome-widget/plugin/awkeys.cpp
|
||||||
|
@@ -234,8 +234,10 @@ void AWKeys::reinitKeys(const QStringList currentKeys)
|
||||||
|
void AWKeys::updateTextData()
|
||||||
|
{
|
||||||
|
// do not do it in parallel to avoid race condition
|
||||||
|
+ m_mutex.lock();
|
||||||
|
calculateValues();
|
||||||
|
QString text = parsePattern(keyOperator->pattern());
|
||||||
|
+ m_mutex.unlock();
|
||||||
|
|
||||||
|
emit(needTextToBeUpdated(text));
|
||||||
|
emit(dataAggregator->updateData(values));
|
||||||
@@ -234,8 +234,10 @@ void AWKeys::reinitKeys(const QStringList currentKeys)
|
|||||||
void AWKeys::updateTextData()
|
void AWKeys::updateTextData()
|
||||||
{
|
{
|
||||||
// do not do it in parallel to avoid race condition
|
// do not do it in parallel to avoid race condition
|
||||||
|
m_mutex.lock();
|
||||||
calculateValues();
|
calculateValues();
|
||||||
QString text = parsePattern(keyOperator->pattern());
|
QString text = parsePattern(keyOperator->pattern());
|
||||||
|
m_mutex.unlock();
|
||||||
|
|
||||||
emit(needTextToBeUpdated(text));
|
emit(needTextToBeUpdated(text));
|
||||||
emit(dataAggregator->updateData(values));
|
emit(dataAggregator->updateData(values));
|
||||||
|
|||||||
Reference in new issue
Block a user