mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
add fix for possible race condition (#96)
This commit is contained in:
parent
75d101cc8b
commit
b20a96d32f
15
patches/fix-race-condition.patch
Normal file
15
patches/fix-race-condition.patch
Normal file
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user