Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Verbruggen <erik@verbruggen.consulting>2021-10-15 15:05:01 +0300
committerErik Verbruggen <Erik.Verbruggen@Me.com>2021-12-03 12:45:08 +0300
commit470bf76e6362a4379e6548e466971e3a2e532ccd (patch)
treef697e03da9fde7e1d97394d867c6c3eed7f314d9 /src/gui/settingsdialog.h
parented603153da4fdc385f90982c88660fe0cec2f7ea (diff)
Use the refcounted AccountStatePtr as much as possible
The AccountManager creates AccountState objects, and stores them in a shared pointer. Previously, the raw pointer was given out, and stored in other objects. That made removal very tricky: when an account gets removed, the underlying object gets deleted, and then all classes that listen get notified of the deletion. Those classes would sometimes put a nullptr into the AccountState pointer they stored, and in each usage would (hopefully) check for a nullptr. The problem was that a number of checks were missing, which the clang static analyser pointed out. This patch changes nearly all uses of a raw pointer into the shared pointer, thereby making sure all usages have a valid reference, even when account deletion happens. The two places where a raw pointer is still used, now put it into a refcounted pointer as soon as possible.
Diffstat (limited to 'src/gui/settingsdialog.h')
-rw-r--r--src/gui/settingsdialog.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h
index c96e559e0..15035def0 100644
--- a/src/gui/settingsdialog.h
+++ b/src/gui/settingsdialog.h
@@ -19,8 +19,9 @@
#include <QMainWindow>
#include <QStyledItemDelegate>
-#include "progressdispatcher.h"
+#include "accountstate.h"
#include "owncloudgui.h"
+#include "progressdispatcher.h"
class QAction;
class QActionGroup;
@@ -29,8 +30,6 @@ class QStandardItemModel;
namespace OCC {
-class AccountState;
-
namespace Ui {
class SettingsDialog;
}
@@ -62,7 +61,7 @@ public slots:
void showActivityPage();
void showIssuesList();
void slotSwitchPage(QAction *action);
- void slotRefreshActivity(AccountState *accountState);
+ void slotRefreshActivity(AccountStatePtr accountState);
void slotRefreshActivityAccountStateSender();
void slotAccountAvatarChanged();
void slotAccountDisplayNameChanged();
@@ -72,8 +71,8 @@ protected:
void setVisible(bool visible) override;
private slots:
- void accountAdded(AccountState *);
- void accountRemoved(AccountState *);
+ void accountAdded(AccountStatePtr);
+ void accountRemoved(AccountStatePtr);
private:
void customizeStyle();