[partition] Fix crash on filesystem changes when encryption is checked

This commit is contained in:
dalto 2024-06-23 14:39:29 -05:00
parent ea4364b8a8
commit dbad8704f5
2 changed files with 20 additions and 6 deletions

View File

@ -467,8 +467,6 @@ ChoicePage::onActionChanged()
{
m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) );
}
m_encryptWidget->setEncryptionCheckbox( m_config->preCheckEncryption() );
}
Device* currd = selectedDevice();
@ -1035,6 +1033,10 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
if ( m_enableEncryptionWidget )
{
m_encryptWidget->show();
if ( m_config->preCheckEncryption() )
{
m_encryptWidget->setEncryptionCheckbox( true );
}
}
m_previewBeforeLabel->setText( tr( "Current:", "@label" ) );
m_selectLabel->setText( tr( "<strong>Select a partition to shrink, "
@ -1087,7 +1089,14 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
case InstallChoice::Erase:
case InstallChoice::Replace:
{
m_encryptWidget->setVisible( shouldShowEncryptWidget( choice ) );
if ( shouldShowEncryptWidget( choice ) )
{
m_encryptWidget->show();
if ( m_config->preCheckEncryption() )
{
m_encryptWidget->setEncryptionCheckbox( true );
}
}
m_previewBeforeLabel->setText( tr( "Current:", "@label" ) );
m_afterPartitionBarsView = new PartitionBarsView( m_previewAfterFrame );
m_afterPartitionBarsView->setNestedPartitionsMode( mode );

View File

@ -182,10 +182,15 @@ EncryptWidget::updateState( const bool notify )
}
}
m_state = state();
if ( notify )
Encryption newState = state();
if ( newState != m_state )
{
Q_EMIT stateChanged( m_state );
m_state = newState;
if ( notify )
{
Q_EMIT stateChanged( m_state );
}
}
}