mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-23 20:15:32 +00:00
record-store: Ensure store stays alive during async tasks
As GOM does not allow us to cancel asynchronous tasks, we need to hold references temporarily.
This commit is contained in:
parent
b49e086549
commit
46736a63fa
1 changed files with 15 additions and 6 deletions
|
@ -159,6 +159,7 @@ load_calls_fetch_cb (GomResourceGroup *group,
|
||||||
if (error) {
|
if (error) {
|
||||||
g_debug ("Error fetching call records: %s",
|
g_debug ("Error fetching call records: %s",
|
||||||
error->message);
|
error->message);
|
||||||
|
goto exit;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_assert (ok);
|
g_assert (ok);
|
||||||
|
@ -193,6 +194,8 @@ load_calls_fetch_cb (GomResourceGroup *group,
|
||||||
|
|
||||||
g_free (records);
|
g_free (records);
|
||||||
g_object_unref (group);
|
g_object_unref (group);
|
||||||
|
exit:
|
||||||
|
g_object_unref (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +214,7 @@ load_calls_find_cb (GomRepository *repository,
|
||||||
if (error) {
|
if (error) {
|
||||||
g_debug ("Error finding call records in database `%s': %s",
|
g_debug ("Error finding call records in database `%s': %s",
|
||||||
self->filename, error->message);
|
self->filename, error->message);
|
||||||
return;
|
goto exit;
|
||||||
}
|
}
|
||||||
g_assert (group != NULL);
|
g_assert (group != NULL);
|
||||||
|
|
||||||
|
@ -219,7 +222,7 @@ load_calls_find_cb (GomRepository *repository,
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
g_debug ("No call records found in database `%s'",
|
g_debug ("No call records found in database `%s'",
|
||||||
self->filename);
|
self->filename);
|
||||||
return;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("Found %u call records in database `%s', fetching",
|
g_debug ("Found %u call records in database `%s', fetching",
|
||||||
|
@ -228,7 +231,9 @@ load_calls_find_cb (GomRepository *repository,
|
||||||
0,
|
0,
|
||||||
count,
|
count,
|
||||||
(GAsyncReadyCallback) load_calls_fetch_cb,
|
(GAsyncReadyCallback) load_calls_fetch_cb,
|
||||||
self);
|
g_object_ref (self));
|
||||||
|
exit:
|
||||||
|
g_object_unref (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,7 +258,7 @@ load_calls (CallsRecordStore *self)
|
||||||
filter,
|
filter,
|
||||||
sorting,
|
sorting,
|
||||||
(GAsyncReadyCallback) load_calls_find_cb,
|
(GAsyncReadyCallback) load_calls_find_cb,
|
||||||
self);
|
g_object_ref (self));
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (filter));
|
g_object_unref (G_OBJECT (filter));
|
||||||
}
|
}
|
||||||
|
@ -283,6 +288,8 @@ set_up_repo_migrate_cb (GomRepository *repo,
|
||||||
self->filename);
|
self->filename);
|
||||||
load_calls (self);
|
load_calls (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,7 +317,7 @@ set_up_repo (CallsRecordStore *self)
|
||||||
RECORD_STORE_VERSION,
|
RECORD_STORE_VERSION,
|
||||||
types,
|
types,
|
||||||
(GAsyncReadyCallback) set_up_repo_migrate_cb,
|
(GAsyncReadyCallback) set_up_repo_migrate_cb,
|
||||||
self);
|
g_object_ref (self));
|
||||||
|
|
||||||
self->repository = repo;
|
self->repository = repo;
|
||||||
}
|
}
|
||||||
|
@ -363,6 +370,8 @@ open_repo_adapter_open_cb (GomAdapter *adapter,
|
||||||
self->filename);
|
self->filename);
|
||||||
set_up_repo (self);
|
set_up_repo (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -392,7 +401,7 @@ open_repo (CallsRecordStore *self)
|
||||||
(self->adapter,
|
(self->adapter,
|
||||||
uri,
|
uri,
|
||||||
(GAsyncReadyCallback) open_repo_adapter_open_cb,
|
(GAsyncReadyCallback) open_repo_adapter_open_cb,
|
||||||
self);
|
g_object_ref (self));
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue