mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 01:15:38 -04:00
[partition] Extra helper classes for doing reset and refresh
- The ResetHelper only finalized changes to the module on destruction, but calls to refresh() assumed it was already done. This leads to crashes when refresh() uses an intermediate state of the model. Introduce extra helpers, and rename refresh() to avoid calling the old implementation from any code. The new helper just creates and destroys a ResetHelper, before creating and destroying an object that calls the new refreshAfterModelChange(). FIXES #1019
This commit is contained in:
parent
4602b30264
commit
fe662345bd
2 changed files with 65 additions and 29 deletions
|
@ -54,6 +54,25 @@ class PartitionCoreModule : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* This helper class calls refresh() on the module
|
||||
* on destruction (nothing else). It is used as
|
||||
* part of the model-consistency objects, along with
|
||||
* PartitionModel::ResetHelper.
|
||||
*/
|
||||
class RefreshHelper
|
||||
{
|
||||
public:
|
||||
RefreshHelper( PartitionCoreModule* module );
|
||||
~RefreshHelper();
|
||||
|
||||
RefreshHelper( const RefreshHelper& ) = delete;
|
||||
RefreshHelper& operator=( const RefreshHelper& ) = delete;
|
||||
|
||||
private:
|
||||
PartitionCoreModule* m_module;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The SummaryInfo struct is a wrapper for PartitionModel instances for
|
||||
* a given Device.
|
||||
|
@ -192,7 +211,7 @@ Q_SIGNALS:
|
|||
void deviceReverted( Device* device );
|
||||
|
||||
private:
|
||||
void refresh();
|
||||
void refreshAfterModelChange();
|
||||
|
||||
/**
|
||||
* Owns the Device, PartitionModel and the jobs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue