mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-10-12 02:42:48 +00:00
Centralize extra view ref and sink if required
Doing this in only one place makes sense as its clearer. Previously we ref:ed one extra time for the window->view ref but left the floating ref to be taked when adding the widget to a parent. This breaks when we free the view before adding it to a parent, so we need to properly sink it.
This commit is contained in:
parent
c302620c14
commit
26a91c8e22
|
@ -60,13 +60,18 @@ nautilus_view_factory_create (const char *id,
|
|||
NautilusWindowSlotInfo *slot)
|
||||
{
|
||||
const NautilusViewInfo *view_info;
|
||||
NautilusView *view;
|
||||
|
||||
view_info = nautilus_view_factory_lookup (id);
|
||||
if (view_info == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return view_info->create (slot);
|
||||
view = view_info->create (slot);
|
||||
if (g_object_is_floating (view)) {
|
||||
g_object_ref_sink (view);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -804,7 +804,6 @@ fm_desktop_icon_view_create (NautilusWindowSlotInfo *slot)
|
|||
view = g_object_new (FM_TYPE_DESKTOP_ICON_VIEW,
|
||||
"window-slot", slot,
|
||||
NULL);
|
||||
g_object_ref (view);
|
||||
return NAUTILUS_VIEW (view);
|
||||
}
|
||||
|
||||
|
|
|
@ -355,7 +355,6 @@ fm_empty_view_create (NautilusWindowSlotInfo *slot)
|
|||
view = g_object_new (FM_TYPE_EMPTY_VIEW,
|
||||
"window-slot", slot,
|
||||
NULL);
|
||||
g_object_ref (view);
|
||||
|
||||
return NAUTILUS_VIEW (view);
|
||||
}
|
||||
|
|
|
@ -3000,7 +3000,6 @@ fm_icon_view_create (NautilusWindowSlotInfo *slot)
|
|||
"window-slot", slot,
|
||||
"compact", FALSE,
|
||||
NULL);
|
||||
g_object_ref (view);
|
||||
return NAUTILUS_VIEW (view);
|
||||
}
|
||||
|
||||
|
@ -3013,7 +3012,6 @@ fm_compact_view_create (NautilusWindowSlotInfo *slot)
|
|||
"window-slot", slot,
|
||||
"compact", TRUE,
|
||||
NULL);
|
||||
g_object_ref (view);
|
||||
return NAUTILUS_VIEW (view);
|
||||
}
|
||||
|
||||
|
|
|
@ -2890,7 +2890,6 @@ fm_list_view_create (NautilusWindowSlotInfo *slot)
|
|||
view = g_object_new (FM_TYPE_LIST_VIEW,
|
||||
"window-slot", slot,
|
||||
NULL);
|
||||
g_object_ref (view);
|
||||
return NAUTILUS_VIEW (view);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue