fix to potential crash when reloading database
This commit is contained in:
@@ -475,22 +475,26 @@ namespace keepass2android
|
||||
|
||||
builder.SetMessage(activity.GetString(Resource.String.AskReloadFile));
|
||||
|
||||
builder.SetPositiveButton(activity.GetString(Android.Resource.String.Yes),
|
||||
bool buttonPressed = false;
|
||||
|
||||
builder.SetPositiveButton(activity.GetString(Android.Resource.String.Yes),
|
||||
(dlgSender, dlgEvt) =>
|
||||
{
|
||||
{
|
||||
buttonPressed = true;
|
||||
CurrentDb.ReloadRequested = true;
|
||||
activity.SetResult(KeePass.ExitReloadDb);
|
||||
activity.Finish();
|
||||
if (actionOnResult != null)
|
||||
{
|
||||
actionOnResult(true);
|
||||
actionOnResult = null;
|
||||
{
|
||||
actionOnResult(true);
|
||||
actionOnResult = null;
|
||||
}
|
||||
});
|
||||
|
||||
builder.SetNegativeButton(activity.GetString(Android.Resource.String.No), (dlgSender, dlgEvt) =>
|
||||
{
|
||||
if (actionOnResult != null)
|
||||
{
|
||||
buttonPressed = true;
|
||||
if (actionOnResult != null)
|
||||
{
|
||||
actionOnResult(false);
|
||||
actionOnResult = null;
|
||||
@@ -501,10 +505,18 @@ namespace keepass2android
|
||||
Dialog dialog = builder.Create();
|
||||
|
||||
dialog.SetOnDismissListener(new Util.DismissListener(() =>
|
||||
{
|
||||
if (actionOnResult != null)
|
||||
actionOnResult(false);
|
||||
}));
|
||||
{
|
||||
//dismiss can be called when we're calling activity.Finish() during button press.
|
||||
//don't do anything then.
|
||||
if (buttonPressed)
|
||||
return;
|
||||
|
||||
if (actionOnResult != null)
|
||||
{
|
||||
actionOnResult(false);
|
||||
actionOnResult = null;
|
||||
}
|
||||
}));
|
||||
|
||||
dialog.Show();
|
||||
}
|
||||
|
@@ -77,10 +77,15 @@ namespace keepass2android.view
|
||||
AddView(gv, lp);
|
||||
}
|
||||
|
||||
private void PopulateView(View gv, PwGroup pw) {
|
||||
private void PopulateView(View gv, PwGroup pw)
|
||||
{
|
||||
_pwGroup = pw;
|
||||
|
||||
ImageView iv = (ImageView) gv.FindViewById(Resource.Id.icon);
|
||||
Kp2aLog.Log($"Populating group view {_groupBaseActivity.IsFinishing} {pw.Name}");
|
||||
|
||||
if (_groupBaseActivity.IsFinishing)
|
||||
return;
|
||||
|
||||
ImageView iv = (ImageView) gv.FindViewById(Resource.Id.icon);
|
||||
Database db = App.Kp2a.FindDatabaseForElement(pw);
|
||||
db.DrawableFactory.AssignDrawableTo(iv, _groupBaseActivity, db.KpDatabase, pw.IconId, pw.CustomIconUuid, true);
|
||||
gv.FindViewById(Resource.Id.icon).Visibility = ViewStates.Visible;
|
||||
|
Reference in New Issue
Block a user