mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 04:15:32 +00:00
call-window: Improve readability of remove_call function
The casual reader might be tricked into believing CallsCallSelectorItem would leak here, which was not actually the case.
This commit is contained in:
parent
d7d97e8f67
commit
2fc5533e1a
1 changed files with 6 additions and 12 deletions
|
@ -182,29 +182,23 @@ remove_call (CallsCallWindow *self,
|
|||
CallsCall *call,
|
||||
const gchar *reason)
|
||||
{
|
||||
g_autoptr (CallsCallSelectorItem) item = NULL;
|
||||
gint position;
|
||||
guint n_calls;
|
||||
|
||||
g_return_if_fail (CALLS_IS_CALL_WINDOW (self));
|
||||
g_return_if_fail (CALLS_IS_CALL (call));
|
||||
|
||||
position = 0;
|
||||
item = g_list_model_get_item (G_LIST_MODEL (self->calls), position);
|
||||
while (item != NULL) {
|
||||
n_calls = g_list_model_get_n_items (G_LIST_MODEL (self->calls));
|
||||
for (guint i = 0; i < n_calls; i++) {
|
||||
g_autoptr (CallsCallSelectorItem) item =
|
||||
g_list_model_get_item (G_LIST_MODEL (self->calls), i);
|
||||
CallsCallDisplay *display = calls_call_selector_item_get_display (item);
|
||||
|
||||
if (calls_call_display_get_call (display) == call) {
|
||||
g_list_store_remove (self->calls, position);
|
||||
g_list_store_remove (self->calls, i);
|
||||
gtk_container_remove (GTK_CONTAINER (self->call_stack),
|
||||
GTK_WIDGET (display));
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
g_object_unref (item);
|
||||
position++;
|
||||
item = g_list_model_get_item (G_LIST_MODEL (self->calls), position);
|
||||
}
|
||||
|
||||
update_visibility (self);
|
||||
|
|
Loading…
Reference in a new issue