mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:40:05 +00:00 
			
		
		
		
	Fix signal usage and possible race condition
This commit is contained in:
		
							parent
							
								
									260b7c73a4
								
							
						
					
					
						commit
						fe61f31c40
					
				
					 1 changed files with 20 additions and 10 deletions
				
			
		|  | @ -44,7 +44,8 @@ public: | |||
|        activeBoxOuter_ {std::make_shared<gl::draw::Rectangle>(context)}, | ||||
|        activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)}, | ||||
|        geoIcons_ {std::make_shared<gl::draw::GeoIcons>(context)}, | ||||
|        icons_ {std::make_shared<gl::draw::Icons>(context)} | ||||
|        icons_ {std::make_shared<gl::draw::Icons>(context)}, | ||||
|        renderMutex_ {} | ||||
|    { | ||||
|       auto& generalSettings = settings::GeneralSettings::Instance(); | ||||
| 
 | ||||
|  | @ -144,6 +145,9 @@ public: | |||
|    QMargins lastColorTableMargins_ {}; | ||||
| 
 | ||||
|    double                             cursorScale_ {1}; | ||||
|    boost::signals2::scoped_connection cursorScaleConnection_; | ||||
| 
 | ||||
|    std::mutex renderMutex_; | ||||
| 
 | ||||
|    std::string sweepTimeString_ {}; | ||||
|    bool        sweepTimeNeedsUpdate_ {true}; | ||||
|  | @ -172,6 +176,11 @@ void OverlayLayerImpl::SetCusorLocation(common::Coordinate coordinate) | |||
| 
 | ||||
| void OverlayLayerImpl::SetupGeoIcons() | ||||
| { | ||||
|    const std::unique_lock lock {renderMutex_}; | ||||
| 
 | ||||
|    auto& generalSettings = settings::GeneralSettings::Instance(); | ||||
|    cursorScale_          = generalSettings.cursor_icon_scale().GetValue(); | ||||
| 
 | ||||
|    const std::string& texturePath = | ||||
|       types::GetTexturePath(types::ImageTexture::Dot3); | ||||
|    cursorIconName_ = fmt::format( | ||||
|  | @ -219,12 +228,11 @@ void OverlayLayer::Initialize() | |||
| 
 | ||||
|    // Geo Icons
 | ||||
|    auto& generalSettings = settings::GeneralSettings::Instance(); | ||||
|    p->cursorScale_       = generalSettings.cursor_icon_scale().GetValue(); | ||||
|    p->SetupGeoIcons(); | ||||
|    generalSettings.cursor_icon_scale().RegisterValueChangedCallback( | ||||
|       [this](double value) | ||||
|    p->cursorScaleConnection_ = | ||||
|       generalSettings.cursor_icon_scale().changed_signal().connect( | ||||
|          [this]() | ||||
|          { | ||||
|          p->cursorScale_ = value; | ||||
|             p->SetupGeoIcons(); | ||||
|             Q_EMIT NeedsRendering(); | ||||
|          }); | ||||
|  | @ -322,6 +330,8 @@ void OverlayLayer::Initialize() | |||
| 
 | ||||
| void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params) | ||||
| { | ||||
|    const std::unique_lock lock {p->renderMutex_}; | ||||
| 
 | ||||
|    gl::OpenGLFunctions& gl               = context()->gl(); | ||||
|    auto                 radarProductView = context()->radar_product_view(); | ||||
|    auto&                settings         = context()->settings(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak