forked from qt-creator/qt-creator
		
	Clang: Fix crash when removing diagnostic config
1. Create some Qt Console Application from the wizard
  2. Open Tools > Options > C++ > Code Model
    2.1 Click "Manage..." and create a custom configuration "custom" and
      finish with OK.
    2.2 Set "custom" as diagnostic config.
  3. Analyze > "Clang-Tidy and Clazy..."
    3.1 Use "Custom Settings"
    3.2 Click "Manage..." and remove "custom" ==> Crash
The crash happened because the code model used an invalid diagnostic
config id. The invalid id came from the settings, which were not
correctly upated.
Fixes: QTCREATORBUG-21273
Change-Id: I5242f7c92e121eec8558fa7923139bb3d759c676
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
			
			
This commit is contained in:
		@@ -195,6 +195,11 @@ void CppCodeModelSettings::setClangDiagnosticConfigId(const Core::Id &configId)
 | 
			
		||||
    m_clangDiagnosticConfigId = configId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CppCodeModelSettings::resetClangDiagnosticConfigId()
 | 
			
		||||
{
 | 
			
		||||
    m_clangDiagnosticConfigId = initialClangDiagnosticConfigId();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ClangDiagnosticConfig CppCodeModelSettings::clangDiagnosticConfig() const
 | 
			
		||||
{
 | 
			
		||||
    const ClangDiagnosticConfigsModel configsModel(m_clangCustomDiagnosticConfigs);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user