From f142b90efe1e02280c50fe9d751a27ed3fad66ee Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Dec 2019 13:07:42 +0100 Subject: [PATCH] Get widget messages in a transaction --- .../email/WidgetUnifiedRemoteViewsFactory.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java index a1c44bf231..708fe585b7 100644 --- a/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java +++ b/app/src/main/java/eu/faircode/email/WidgetUnifiedRemoteViewsFactory.java @@ -81,7 +81,15 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot colorWidgetRead = ContextCompat.getColor(context, R.color.colorWidgetRead); DB db = DB.getInstance(context); - messages = db.message().getWidgetUnified(folder < 0 ? null : folder, threading, unseen, flagged); + try { + db.beginTransaction(); + + messages = db.message().getWidgetUnified(folder < 0 ? null : folder, threading, unseen, flagged); + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } } @Override