mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-30 21:03:41 +00:00 
			
		
		
		
	add fix for possible race condition (#96)
This commit is contained in:
		
							
								
								
									
										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)); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user