From dbad8704f5e25a4b6df8e2b01ee8b806c2915dcb Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 23 Jun 2024 14:39:29 -0500 Subject: [PATCH] [partition] Fix crash on filesystem changes when encryption is checked --- src/modules/partition/gui/ChoicePage.cpp | 15 ++++++++++++--- src/modules/partition/gui/EncryptWidget.cpp | 11 ++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 62cf0f6e1..366041d10 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -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( "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 ); diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index 8726df147..ea0f57b29 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -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 ); + } } }