mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-26 03:02:24 -05:00
Never hang on to reference to PwDatabase (allow it to be garbage collected when cleared)
This commit is contained in:
parent
8a1136aa97
commit
84efaae462
@ -31,7 +31,6 @@ namespace keepass2android.settings
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RoundsPreference : DialogPreference {
|
public class RoundsPreference : DialogPreference {
|
||||||
|
|
||||||
internal PwDatabase PwDatabase;
|
|
||||||
internal TextView RoundsView;
|
internal TextView RoundsView;
|
||||||
|
|
||||||
protected override View OnCreateDialogView() {
|
protected override View OnCreateDialogView() {
|
||||||
@ -40,8 +39,7 @@ namespace keepass2android.settings
|
|||||||
RoundsView = (TextView) view.FindViewById(Resource.Id.rounds);
|
RoundsView = (TextView) view.FindViewById(Resource.Id.rounds);
|
||||||
|
|
||||||
Database db = App.Kp2a.GetDb();
|
Database db = App.Kp2a.GetDb();
|
||||||
PwDatabase = db.KpDatabase;
|
ulong numRounds = db.KpDatabase.KeyEncryptionRounds;
|
||||||
ulong numRounds = PwDatabase.KeyEncryptionRounds;
|
|
||||||
RoundsView.Text = numRounds.ToString(CultureInfo.InvariantCulture);
|
RoundsView.Text = numRounds.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
@ -70,14 +68,16 @@ namespace keepass2android.settings
|
|||||||
rounds = 1;
|
rounds = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong oldRounds = PwDatabase.KeyEncryptionRounds;
|
Database db = App.Kp2a.GetDb();
|
||||||
|
|
||||||
|
ulong oldRounds = db.KpDatabase.KeyEncryptionRounds;
|
||||||
|
|
||||||
if (oldRounds == rounds)
|
if (oldRounds == rounds)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PwDatabase.KeyEncryptionRounds = rounds;
|
db.KpDatabase.KeyEncryptionRounds = rounds;
|
||||||
|
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
SaveDb save = new SaveDb(Context, App.Kp2a, new AfterSave(Context, handler, oldRounds, this));
|
SaveDb save = new SaveDb(Context, App.Kp2a, new AfterSave(Context, handler, oldRounds, this));
|
||||||
@ -108,7 +108,8 @@ namespace keepass2android.settings
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DisplayMessage(_ctx);
|
DisplayMessage(_ctx);
|
||||||
_pref.PwDatabase.KeyEncryptionRounds = _oldRounds;
|
|
||||||
|
App.Kp2a.GetDb().KpDatabase.KeyEncryptionRounds = _oldRounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Run();
|
base.Run();
|
||||||
|
Loading…
Reference in New Issue
Block a user