[partition] Use swap-choice member, not the combobox pointer
- Store changes to the selected swap-choice when the combobox changes - Use that member instead of dereferencing the combobox This avoids nullptr crashes when the combobox isn't even created (e.g. when there is only one swap choice).
This commit is contained in:
parent
a4e6d4cd35
commit
5f20eedb6e
@ -318,7 +318,7 @@ ChoicePage::setupChoices()
|
|||||||
this, &ChoicePage::onActionChanged );
|
this, &ChoicePage::onActionChanged );
|
||||||
if ( m_eraseSwapChoiceComboBox )
|
if ( m_eraseSwapChoiceComboBox )
|
||||||
connect( m_eraseSwapChoiceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect( m_eraseSwapChoiceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &ChoicePage::onActionChanged );
|
this, &ChoicePage::onEraseSwapChoiceChanged );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_somethingElseButton->setText( tr( "<strong>Manual partitioning</strong><br/>"
|
m_somethingElseButton->setText( tr( "<strong>Manual partitioning</strong><br/>"
|
||||||
@ -428,6 +428,15 @@ ChoicePage::onActionChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChoicePage::onEraseSwapChoiceChanged()
|
||||||
|
{
|
||||||
|
if ( m_eraseSwapChoiceComboBox )
|
||||||
|
{
|
||||||
|
m_eraseSwapChoice = static_cast<PartitionActions::Choices::SwapChoice>( m_eraseSwapChoiceComboBox->currentData().toInt() );
|
||||||
|
onActionChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
||||||
@ -448,7 +457,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
|
|||||||
m_encryptWidget->passphrase(),
|
m_encryptWidget->passphrase(),
|
||||||
gs->value( "efiSystemPartition" ).toString(),
|
gs->value( "efiSystemPartition" ).toString(),
|
||||||
CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() ),
|
CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() ),
|
||||||
static_cast<PartitionActions::Choices::SwapChoice>( m_eraseSwapChoiceComboBox->currentData().toInt() )
|
m_eraseSwapChoice
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
|
@ -116,8 +116,10 @@ private slots:
|
|||||||
void onEncryptWidgetStateChanged();
|
void onEncryptWidgetStateChanged();
|
||||||
void onHomeCheckBoxStateChanged();
|
void onHomeCheckBoxStateChanged();
|
||||||
|
|
||||||
/** @brief Calls applyActionChoice() as needed. */
|
/// @brief Calls applyActionChoice() as needed.
|
||||||
void onActionChanged();
|
void onActionChanged();
|
||||||
|
/// @brief Calls onActionChanged() as needed.
|
||||||
|
void onEraseSwapChoiceChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateNextEnabled();
|
void updateNextEnabled();
|
||||||
|
Loading…
Reference in New Issue
Block a user