mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 07:49:50 -05:00
Use QSharedPointer
This commit is contained in:
parent
a1aad5d165
commit
aba2acb062
@ -162,7 +162,7 @@ void DatabaseOpenWidget::enterKey(const QString& pw, const QString& keyFile)
|
||||
void DatabaseOpenWidget::openDatabase()
|
||||
{
|
||||
KeePass2Reader reader;
|
||||
QScopedPointer<CompositeKey> masterKey(databaseKey());
|
||||
QSharedPointer<CompositeKey> masterKey = databaseKey();
|
||||
if (masterKey.isNull()) {
|
||||
return;
|
||||
}
|
||||
@ -192,9 +192,9 @@ void DatabaseOpenWidget::openDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
CompositeKey* DatabaseOpenWidget::databaseKey()
|
||||
QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
|
||||
{
|
||||
CompositeKey* masterKey = new CompositeKey();
|
||||
auto masterKey = QSharedPointer<CompositeKey>::create();
|
||||
|
||||
if (m_ui->checkPassword->isChecked()) {
|
||||
masterKey->addKey(PasswordKey(m_ui->editPassword->text()));
|
||||
@ -210,8 +210,7 @@ CompositeKey* DatabaseOpenWidget::databaseKey()
|
||||
if (!key.load(keyFilename, &errorMsg)) {
|
||||
m_ui->messageWidget->showMessage(tr("Can't open key file").append(":\n").append(errorMsg),
|
||||
MessageWidget::Error);
|
||||
delete masterKey;
|
||||
return nullptr;
|
||||
return QSharedPointer<CompositeKey>();
|
||||
}
|
||||
masterKey->addKey(key);
|
||||
lastKeyFiles[m_filename] = keyFilename;
|
||||
|
@ -52,7 +52,7 @@ signals:
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
CompositeKey* databaseKey();
|
||||
QSharedPointer<CompositeKey> databaseKey();
|
||||
|
||||
protected slots:
|
||||
virtual void openDatabase();
|
||||
|
Loading…
Reference in New Issue
Block a user