summaryrefslogtreecommitdiff
path: root/src/contacts-contact-pane.vala
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2022-04-27 10:10:58 -0700
committerNiels De Graef <nielsdegraef@gmail.com>2022-06-06 14:41:39 +0000
commit50457308b8785874dc9f774013b7eaa6cf1e5068 (patch)
tree696779079508190cfe41f6d8f5e200115431acae /src/contacts-contact-pane.vala
parentc57e4d7d2fba6439b977b5a1888a9e0d1c0fa998 (diff)
downloadgnome-contacts-50457308b8785874dc9f774013b7eaa6cf1e5068.tar.gz
Wait for store to be quiescent before applying contact changes
It's not safe to try and add or edit a contact before the store is quiescent, it causes crashes. Signed-off-by: Adam Williamson <awilliam@redhat.com>
Diffstat (limited to 'src/contacts-contact-pane.vala')
-rw-r--r--src/contacts-contact-pane.vala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 258104e..0b94bc0 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -176,6 +176,16 @@ public class Contacts.ContactPane : Adw.Bin {
/* Show fake contact to the user */
/* TODO: block changes to fake contact */
show_contact_sheet ();
+ // Wait that the store gets quiescent if it isn't already
+ if (!this.store.aggregator.is_quiescent) {
+ ulong signal_id;
+ SourceFunc callback = apply_changes.callback;
+ signal_id = this.store.quiescent.connect (() => {
+ callback ();
+ });
+ yield;
+ disconnect (signal_id);
+ }
var fake_individual = individual as FakeIndividual;
if (fake_individual != null && fake_individual.real_individual == null) {
// Create a new persona in the primary store based on the fake persona