StartGui: Fix crash in GeneralSettingsWidget::onNavigationStyleChanged

It's not allowed to store the C string of a tmp. byte array as the pointer will become dangling and causes undefined behaviour
This commit is contained in:
wmayer
2024-06-04 20:05:56 +02:00
committed by wwmayer
parent 9456df5a4b
commit 36a7fd9be4

View File

@@ -193,10 +193,10 @@ void GeneralSettingsWidget::onNavigationStyleChanged(int index)
if (index < 0) {
return; // happens when clearing the combo box in retranslateUi()
}
auto navStyleName = _navigationStyleComboBox->itemData(index).toByteArray().data();
auto navStyleName = _navigationStyleComboBox->itemData(index).toByteArray();
ParameterGrp::handle hGrp =
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
hGrp->SetASCII("NavigationStyle", navStyleName);
hGrp->SetASCII("NavigationStyle", navStyleName.constData());
}
bool GeneralSettingsWidget::eventFilter(QObject* object, QEvent* event)