Replace gtk_widget_destroy everywhere

Replace all remaining uses of gtk_widget_destroy
by gtk_container_remove or g_object_unref.
This commit is contained in:
Matthias Clasen 2020-05-09 10:33:02 -04:00
parent cd0081d08a
commit 025375ff5f
50 changed files with 237 additions and 291 deletions

View File

@ -31,12 +31,7 @@ on_name_vanished (GDBusConnection *connection,
if (!name_seen)
return;
if (placeholder)
{
gtk_widget_destroy (placeholder);
g_object_unref (placeholder);
placeholder = NULL;
}
g_clear_object (&placeholder);
}
#ifdef G_OS_WIN32

View File

@ -25,9 +25,9 @@ simple_grid_dispose (GObject *object)
{
SimpleGrid *self = SIMPLE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (simple_grid_parent_class)->dispose (object);
}

View File

@ -26,9 +26,9 @@ interactive_grid_dispose (GObject *object)
{
InteractiveGrid *self = INTERACTIVE_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (interactive_grid_parent_class)->dispose (object);
}

View File

@ -24,9 +24,9 @@ vfl_grid_dispose (GObject *object)
{
VflGrid *self = VFL_GRID (object);
g_clear_pointer (&self->button1, gtk_widget_destroy);
g_clear_pointer (&self->button2, gtk_widget_destroy);
g_clear_pointer (&self->button3, gtk_widget_destroy);
g_clear_pointer (&self->button1, gtk_widget_unparent);
g_clear_pointer (&self->button2, gtk_widget_unparent);
g_clear_pointer (&self->button3, gtk_widget_unparent);
G_OBJECT_CLASS (vfl_grid_parent_class)->dispose (object);
}

View File

@ -138,7 +138,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_widget_show (label);
gtk_widget_destroy (entry);
gtk_container_remove (GTK_CONTAINER (canvas), entry);
}
static void
@ -170,7 +170,9 @@ edit_cb (GtkWidget *button, GtkWidget *child)
static void
delete_cb (GtkWidget *button, GtkWidget *child)
{
gtk_widget_destroy (child);
GtkWidget *canvas = gtk_widget_get_parent (child);
gtk_container_remove (GTK_CONTAINER (canvas), child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
@ -419,7 +421,6 @@ do_dnd (GtkWidget *do_widget)
{
GtkWidget *sw;
GtkWidget *canvas;
GtkWidget *widget;
GtkWidget *box, *box2, *box3;
const char *colors[] = {
"red", "green", "blue", "magenta", "orange", "gray", "black", "yellow",
@ -430,9 +431,8 @@ do_dnd (GtkWidget *do_widget)
int i;
int x, y;
widget = gtk_color_button_new ();
gtk_widget_destroy (widget);
g_type_ensure (GTK_TYPE_COLOR_BUTTON);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@ -1025,7 +1025,7 @@ denorm_coord (hb_ot_var_axis_info_t *axis, int coord)
static void
update_font_variations (void)
{
GtkWidget *child, *next;
GtkWidget *child;
PangoFont *pango_font = NULL;
hb_font_t *hb_font;
hb_face_t *hb_face;
@ -1037,12 +1037,8 @@ update_font_variations (void)
int i;
child = gtk_widget_get_first_child (variations_grid);
while (child != NULL)
{
next = gtk_widget_get_next_sibling (child);
gtk_widget_destroy (child);
child = next;
}
while ((child = gtk_widget_get_first_child (variations_grid)))
gtk_container_remove (GTK_CONTAINER (variations_grid), child);
instance_combo = NULL;

View File

@ -220,12 +220,19 @@ gtk_container_init (GtkContainer *container)
{
}
static void
gtk_container_remove_cb (GtkWidget *child,
GtkContainer *container)
{
gtk_container_remove (container, child);
}
static void
gtk_container_dispose (GObject *object)
{
GtkContainer *container = GTK_CONTAINER (object);
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
gtk_container_foreach (container, (GtkCallback) gtk_container_remove_cb, container);
G_OBJECT_CLASS (gtk_container_parent_class)->dispose (object);
}

View File

@ -548,7 +548,7 @@ populate_completion (GtkEmojiCompletion *completion,
const char *text,
guint offset)
{
GList *children, *l;
GtkWidget *child;
guint n_matches;
guint n_added;
GVariantIter iter;
@ -562,10 +562,8 @@ populate_completion (GtkEmojiCompletion *completion,
}
completion->offset = offset;
children = gtk_container_get_children (GTK_CONTAINER (completion->list));
for (l = children; l; l = l->next)
gtk_widget_destroy (GTK_WIDGET (l->data));
g_list_free (children);
while ((child = gtk_widget_get_first_child (completion->list)))
gtk_container_remove (GTK_CONTAINER (completion->list), child);
completion->active = NULL;

View File

@ -75,7 +75,7 @@ filechooser_portal_data_free (FilechooserPortalData *data)
if (data->grab_widget)
{
gtk_grab_remove (data->grab_widget);
gtk_widget_destroy (data->grab_widget);
g_object_unref (data->grab_widget);
}
g_clear_object (&data->self);
@ -397,7 +397,7 @@ window_handle_exported (GtkWindow *window,
if (data->modal)
{
data->grab_widget = gtk_label_new ("");
data->grab_widget = g_object_ref_sink (gtk_label_new (""));
gtk_grab_add (GTK_WIDGET (data->grab_widget));
}

View File

@ -2360,7 +2360,7 @@ save_widgets_destroy (GtkFileChooserWidget *impl)
if (impl->save_widgets == NULL)
return;
gtk_widget_destroy (impl->save_widgets);
gtk_container_remove (GTK_CONTAINER (impl->box), impl->save_widgets);
impl->save_widgets = NULL;
impl->save_widgets_table = NULL;
impl->location_entry = NULL;
@ -3091,7 +3091,7 @@ gtk_file_chooser_widget_dispose (GObject *object)
cancel_all_operations (impl);
g_clear_pointer (&impl->rename_file_popover, gtk_widget_unparent);
g_clear_pointer (&impl->browse_files_popover, gtk_widget_destroy);
g_clear_pointer (&impl->browse_files_popover, gtk_widget_unparent);
g_clear_object (&impl->extra_widget);
g_clear_pointer (&impl->bookmarks_manager, _gtk_bookmarks_manager_free);

View File

@ -3911,7 +3911,7 @@ gtk_flow_box_bound_model_changed (GListModel *list,
GtkFlowBoxChild *child;
child = gtk_flow_box_get_child_at_index (box, position);
gtk_widget_destroy (GTK_WIDGET (child));
gtk_container_remove (GTK_CONTAINER (box), GTK_WIDGET (child));
}
for (i = 0; i < added; i++)
@ -4196,6 +4196,7 @@ gtk_flow_box_bind_model (GtkFlowBox *box,
GDestroyNotify user_data_free_func)
{
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
GtkWidget *child;
g_return_if_fail (GTK_IS_FLOW_BOX (box));
g_return_if_fail (model == NULL || G_IS_LIST_MODEL (model));
@ -4210,7 +4211,8 @@ gtk_flow_box_bind_model (GtkFlowBox *box,
g_clear_object (&priv->bound_model);
}
gtk_flow_box_forall (GTK_CONTAINER (box), (GtkCallback) gtk_widget_destroy, NULL);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (box))))
gtk_container_remove (GTK_CONTAINER (box), child);
if (model == NULL)
return;

View File

@ -836,11 +836,12 @@ axis_remove (gpointer key,
gpointer value,
gpointer data)
{
GtkFontChooserWidget *fontchooser = data;
Axis *a = value;
gtk_widget_destroy (a->label);
gtk_widget_destroy (a->scale);
gtk_widget_destroy (a->spin);
gtk_container_remove (GTK_CONTAINER (fontchooser->axis_grid), a->label);
gtk_container_remove (GTK_CONTAINER (fontchooser->axis_grid), a->scale);
gtk_container_remove (GTK_CONTAINER (fontchooser->axis_grid), a->spin);
}
static void
@ -1606,7 +1607,7 @@ gtk_font_chooser_widget_update_font_variations (GtkFontChooserWidget *fontchoose
if (fontchooser->updating_variations)
return FALSE;
g_hash_table_foreach (fontchooser->axes, axis_remove, NULL);
g_hash_table_foreach (fontchooser->axes, axis_remove, fontchooser);
g_hash_table_remove_all (fontchooser->axes);
if ((fontchooser->level & GTK_FONT_CHOOSER_LEVEL_VARIATIONS) == 0)

View File

@ -1716,9 +1716,9 @@ gtk_main_do_event (GdkEvent *event)
if (!gtk_window_group_get_current_grab (window_group) ||
GTK_WIDGET (gtk_widget_get_root (gtk_window_group_get_current_grab (window_group))) == target_widget)
{
if (!GTK_IS_WINDOW (target_widget) ||
if (GTK_IS_WINDOW (target_widget) &&
!gtk_window_emit_close_request (GTK_WINDOW (target_widget)))
gtk_widget_destroy (target_widget);
gtk_window_destroy (GTK_WINDOW (target_widget));
}
g_object_unref (target_widget);
break;

View File

@ -4229,7 +4229,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
g_object_ref (tab_label);
gtk_notebook_remove_tab_label (notebook, page);
if (destroying)
gtk_widget_destroy (tab_label);
gtk_widget_unparent (tab_label);
g_object_unref (tab_label);
}
@ -6100,7 +6100,7 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
children = children->next;
if (page->default_tab)
{
gtk_widget_destroy (page->tab_label);
gtk_widget_unparent (page->tab_label);
page->tab_label = NULL;
}
else
@ -6391,7 +6391,7 @@ gtk_notebook_popup_disable (GtkNotebook *notebook)
gtk_container_foreach (GTK_CONTAINER (notebook->menu_box),
(GtkCallback) gtk_notebook_menu_label_unparent, NULL);
gtk_widget_destroy (notebook->menu);
notebook->menu = NULL;
notebook->menu_box = NULL;

View File

@ -526,7 +526,7 @@ static void
populate_servers (GtkPlacesView *view)
{
GBookmarkFile *server_list;
GList *children;
GtkWidget *child;
gchar **uris;
gsize num_uris;
gint i;
@ -548,8 +548,8 @@ populate_servers (GtkPlacesView *view)
}
/* clear previous items */
children = gtk_container_get_children (GTK_CONTAINER (view->recent_servers_listbox));
g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
while ((child = gtk_widget_get_first_child (view->recent_servers_listbox)))
gtk_container_remove (GTK_CONTAINER (view->recent_servers_listbox), child);
gtk_list_store_clear (view->completion_store);
@ -1084,17 +1084,18 @@ fetch_networks (GtkPlacesView *view)
static void
update_places (GtkPlacesView *view)
{
GList *children;
GList *mounts;
GList *volumes;
GList *drives;
GList *l;
GIcon *icon;
GFile *file;
GtkWidget *child;
/* Clear all previously added items */
children = gtk_container_get_children (GTK_CONTAINER (view->listbox));
g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
while ((child = gtk_widget_get_first_child (view->listbox)))
gtk_container_remove (GTK_CONTAINER (view->listbox), child);
view->network_placeholder = NULL;
/* Inform clients that we started loading */
gtk_places_view_set_loading (view, TRUE);

View File

@ -430,40 +430,12 @@ deconstruct_widgets (GtkPrinterOptionWidget *widget)
{
GtkPrinterOptionWidgetPrivate *priv = widget->priv;
if (priv->check)
{
gtk_widget_destroy (priv->check);
priv->check = NULL;
}
if (priv->combo)
{
gtk_widget_destroy (priv->combo);
priv->combo = NULL;
}
if (priv->entry)
{
gtk_widget_destroy (priv->entry);
priv->entry = NULL;
}
if (priv->image)
{
gtk_widget_destroy (priv->image);
priv->image = NULL;
}
if (priv->label)
{
gtk_widget_destroy (priv->label);
priv->label = NULL;
}
if (priv->info_label)
{
gtk_widget_destroy (priv->info_label);
priv->info_label = NULL;
}
g_clear_pointer (&priv->check, gtk_widget_unparent);
g_clear_pointer (&priv->combo, gtk_widget_unparent);
g_clear_pointer (&priv->entry, gtk_widget_unparent);
g_clear_pointer (&priv->image, gtk_widget_unparent);
g_clear_pointer (&priv->label, gtk_widget_unparent);
g_clear_pointer (&priv->info_label, gtk_widget_unparent);
}
static void

View File

@ -1440,7 +1440,7 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
op_win32 = op->priv->platform_data;
g_signal_emit_by_name (op, "custom-widget-apply", op->priv->custom_widget);
gtk_widget_destroy (op_win32->embed_widget);
g_object_unref (g_object_ref_sink (op_win32->embed_widget));
op_win32->embed_widget = NULL;
op->priv->custom_widget = NULL;
}
@ -1961,7 +1961,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
GlobalFree (printdlgex);
if (invisible)
gtk_widget_destroy (invisible);
gtk_window_destroy (GTK_WINDOW (invisible));
return result;
}

View File

@ -1624,16 +1624,14 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
nrows = grid_rows (GTK_GRID (table));
if (nrows == 0)
gtk_widget_destroy (table);
{
g_object_unref (g_object_ref_sink (table));
}
else
{
has_advanced = TRUE;
frame = wrap_in_frame (group, table);
gtk_widget_show (table);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (dialog->advanced_vbox),
frame);
gtk_container_add (GTK_CONTAINER (dialog->advanced_vbox), frame);
}
}
@ -1940,36 +1938,24 @@ options_changed_cb (GtkPrintUnixDialog *dialog)
dialog->waiting_for_printer = NULL;
}
static void
remove_custom_widget (GtkWidget *widget,
GtkContainer *container)
{
gtk_container_remove (container, widget);
}
static void
extension_point_clear_children (GtkContainer *container)
{
gtk_container_foreach (container,
(GtkCallback)remove_custom_widget,
container);
}
static void
clear_per_printer_ui (GtkPrintUnixDialog *dialog)
{
GtkWidget *child;
if (dialog->finishing_table == NULL)
return;
gtk_container_foreach (GTK_CONTAINER (dialog->finishing_table),
(GtkCallback)gtk_widget_destroy, NULL);
gtk_container_foreach (GTK_CONTAINER (dialog->image_quality_table),
(GtkCallback)gtk_widget_destroy, NULL);
gtk_container_foreach (GTK_CONTAINER (dialog->color_table),
(GtkCallback)gtk_widget_destroy, NULL);
gtk_container_foreach (GTK_CONTAINER (dialog->advanced_vbox),
(GtkCallback)gtk_widget_destroy, NULL);
extension_point_clear_children (GTK_CONTAINER (dialog->extension_point));
while ((child = gtk_widget_get_first_child (dialog->finishing_table)))
gtk_container_remove (GTK_CONTAINER (dialog->finishing_table), child);
while ((child = gtk_widget_get_first_child (dialog->image_quality_table)))
gtk_container_remove (GTK_CONTAINER (dialog->image_quality_table), child);
while ((child = gtk_widget_get_first_child (dialog->color_table)))
gtk_container_remove (GTK_CONTAINER (dialog->color_table), child);
while ((child = gtk_widget_get_first_child (dialog->advanced_vbox)))
gtk_container_remove (GTK_CONTAINER (dialog->advanced_vbox), child);
while ((child = gtk_widget_get_first_child (dialog->extension_point)))
gtk_container_remove (GTK_CONTAINER (dialog->extension_point), child);
}
static void

View File

@ -268,15 +268,7 @@ gtk_shortcuts_group_dispose (GObject *object)
{
GtkShortcutsGroup *self = GTK_SHORTCUTS_GROUP (object);
/*
* Since we overload forall(), the inherited destroy() won't work as normal.
* Remove internal widgets ourself.
*/
if (self->title)
{
gtk_widget_destroy (GTK_WIDGET (self->title));
self->title = NULL;
}
g_clear_pointer ((GtkWidget **)&self->title, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_shortcuts_group_parent_class)->dispose (object);
}

View File

@ -200,17 +200,8 @@ gtk_shortcuts_section_dispose (GObject *object)
{
GtkShortcutsSection *self = GTK_SHORTCUTS_SECTION (object);
if (self->stack)
{
gtk_widget_destroy (GTK_WIDGET (self->stack));
self->stack = NULL;
}
if (self->footer)
{
gtk_widget_destroy (GTK_WIDGET (self->footer));
self->footer = NULL;
}
g_clear_pointer ((GtkWidget **)&self->stack, gtk_widget_unparent);
g_clear_pointer (&self->footer, gtk_widget_unparent);
g_list_free (self->groups);
self->groups = NULL;
@ -573,6 +564,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
guint n_columns;
guint n_pages;
GtkWidget *current_page, *current_column;
GtkWidget *child;
/* collect all groups from the current pages */
groups = NULL;
@ -712,8 +704,8 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
}
/* replace the current pages with the new pages */
children = gtk_container_get_children (GTK_CONTAINER (self->stack));
g_list_free_full (children, (GDestroyNotify)gtk_widget_destroy);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->stack))))
gtk_container_remove (GTK_CONTAINER (self->stack), child);
for (p = pages, n_pages = 0; p; p = p->next, n_pages++)
{

View File

@ -187,7 +187,7 @@ show_uri_done (GObject *object,
"%s", error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
G_CALLBACK (gtk_window_destroy), NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_window_present (GTK_WINDOW (dialog));

View File

@ -330,6 +330,8 @@ gtk_sidebar_row_set_property (GObject *object,
self->placeholder = g_value_get_boolean (value);
if (self->placeholder)
{
GtkWidget *child;
g_clear_object (&self->start_icon);
g_clear_object (&self->end_icon);
g_free (self->label);
@ -347,9 +349,8 @@ gtk_sidebar_row_set_property (GObject *object,
g_clear_object (&self->mount);
g_clear_object (&self->cloud_provider_account);
gtk_container_foreach (GTK_CONTAINER (self),
(GtkCallback) gtk_widget_destroy,
NULL);
while ((child = gtk_widget_get_first_child (GTK_WIDGET (self))))
gtk_container_remove (GTK_CONTAINER (self), child);
gtk_widget_add_css_class (GTK_WIDGET (self), "sidebar-placeholder-row");
}

View File

@ -1958,6 +1958,9 @@ gtk_text_dispose (GObject *object)
g_clear_pointer ((GtkWidget **) &priv->text_handles[TEXT_HANDLE_SELECTION_BOUND], gtk_widget_unparent);
g_clear_object (&priv->extra_menu);
g_clear_pointer (&priv->magnifier_popover, gtk_widget_unparent);
g_clear_pointer (&priv->placeholder, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_text_parent_class)->dispose (object);
}
@ -1972,11 +1975,8 @@ gtk_text_finalize (GObject *object)
g_clear_object (&priv->history);
g_clear_object (&priv->cached_layout);
g_clear_object (&priv->im_context);
g_clear_pointer (&priv->magnifier_popover, gtk_widget_destroy);
g_free (priv->im_module);
g_clear_pointer (&priv->placeholder, gtk_widget_unparent);
if (priv->tabs)
pango_tab_array_free (priv->tabs);

View File

@ -236,7 +236,7 @@ child_segment_delete_func (GtkTextLineSegment *seg,
{
GtkWidget *child = tmp_list->data;
gtk_widget_destroy (child);
gtk_widget_unparent (child);
tmp_list = tmp_list->next;
}

View File

@ -2067,7 +2067,7 @@ gtk_text_view_set_buffer (GtkTextView *text_view,
while (priv->anchored_children.length)
{
AnchoredChild *ac = g_queue_peek_head (&priv->anchored_children);
gtk_widget_destroy (ac->widget);
gtk_widget_unparent (ac->widget);
/* ac is now invalid! */
}
@ -3804,6 +3804,9 @@ gtk_text_view_dispose (GObject *object)
g_clear_pointer ((GtkWidget **) &priv->text_handles[TEXT_HANDLE_CURSOR], gtk_widget_unparent);
g_clear_pointer ((GtkWidget **) &priv->text_handles[TEXT_HANDLE_SELECTION_BOUND], gtk_widget_unparent);
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
g_clear_pointer (&priv->magnifier_popover, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_text_view_parent_class)->dispose (object);
}
@ -3842,10 +3845,6 @@ gtk_text_view_finalize (GObject *object)
text_window_free (priv->text_window);
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
if (priv->magnifier_popover)
gtk_widget_destroy (priv->magnifier_popover);
g_object_unref (priv->im_context);
g_free (priv->im_module);

View File

@ -376,7 +376,7 @@ row_deleted_cb (GtkTreeModel *model,
if (item)
{
gtk_widget_destroy (item);
gtk_widget_unparent (item);
gtk_cell_area_context_reset (popover->context);
}
}
@ -405,9 +405,9 @@ row_changed_cb (GtkTreeModel *model,
if (is_separator != GTK_IS_SEPARATOR (item))
{
GtkWidget *box= gtk_widget_get_parent (item);
GtkWidget *box = gtk_widget_get_parent (item);
gtk_widget_destroy (item);
gtk_container_remove (GTK_CONTAINER (box), item);
item = gtk_tree_popover_create_item (popover, path, iter, FALSE);
@ -732,9 +732,11 @@ static void
rebuild_menu (GtkTreePopover *popover)
{
GtkWidget *stack;
GtkWidget *child;
stack = gtk_popover_get_child (GTK_POPOVER (popover));
gtk_container_foreach (GTK_CONTAINER (stack), (GtkCallback) gtk_widget_destroy, NULL);
while ((child = gtk_widget_get_first_child (stack)))
gtk_container_remove (GTK_CONTAINER (stack), child);
if (popover->model)
gtk_tree_popover_populate (popover);

View File

@ -2073,7 +2073,7 @@ gtk_tree_view_free_rbtree (GtkTreeView *tree_view)
static void
gtk_tree_view_destroy_search_popover (GtkTreeView *tree_view)
{
gtk_widget_destroy (tree_view->search_popover);
gtk_widget_unparent (tree_view->search_popover);
tree_view->search_popover = NULL;
tree_view->search_entry = NULL;

View File

@ -197,7 +197,6 @@ typedef struct
gint title_height;
GtkWidget *title_box;
GtkWidget *titlebar;
GtkWidget *popup_menu;
GtkWidget *key_press_focus;
GdkMonitor *initial_fullscreen_monitor;
@ -2416,7 +2415,7 @@ gtk_window_transient_parent_destroyed (GtkWindow *parent,
GtkWindowPrivate *priv = gtk_window_get_instance_private (GTK_WINDOW (window));
if (priv->destroy_with_parent)
gtk_widget_destroy (GTK_WIDGET (window));
gtk_window_destroy (window);
else
priv->transient_parent = NULL;
}

View File

@ -188,7 +188,7 @@ do_popup_fallback (GtkWindowHandle *self,
GtkWindow *window;
gboolean maximized, resizable, deletable;
g_clear_pointer (&self->fallback_menu, gtk_widget_destroy);
g_clear_pointer (&self->fallback_menu, gtk_widget_unparent);
window = get_window (self);
@ -506,7 +506,7 @@ gtk_window_handle_unrealize (GtkWidget *widget)
{
GtkWindowHandle *self = GTK_WINDOW_HANDLE (widget);
g_clear_pointer (&self->fallback_menu, gtk_widget_destroy);
g_clear_pointer (&self->fallback_menu, gtk_widget_unparent);
GTK_WIDGET_CLASS (gtk_window_handle_parent_class)->unrealize (widget);
}

View File

@ -167,7 +167,7 @@ action_removed_cb (GActionGroup *group,
row = find_row (sl, action_name);
if (row)
gtk_widget_destroy (row);
gtk_container_remove (GTK_CONTAINER (sl->priv->list), row);
}
static void
@ -312,7 +312,7 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
remove_group (sl, page, sl->priv->group);
while ((child = gtk_widget_get_first_child (sl->priv->list)))
gtk_widget_destroy (child);
gtk_container_remove (GTK_CONTAINER (sl->priv->list), child);
if (GTK_IS_APPLICATION (object))
add_group (sl, page, G_ACTION_GROUP (object));

View File

@ -112,7 +112,7 @@ show_node_prop_editor (NodePropEditor *npe)
gtk_popover_popup (GTK_POPOVER (popover));
g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_unparent), NULL);
}
static void

View File

@ -532,7 +532,7 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
gtk_widget_is_ancestor (gen->priv->display_composited, child))
continue;
gtk_widget_destroy (child);
gtk_container_remove (GTK_CONTAINER (list), child);
}
g_list_free (children);
@ -797,7 +797,7 @@ populate_seats (GtkInspectorGeneral *gen)
list = gtk_container_get_children (GTK_CONTAINER (gen->priv->device_box));
for (l = list; l; l = l->next)
gtk_widget_destroy (GTK_WIDGET (l->data));
gtk_container_remove (GTK_CONTAINER (gen->priv->device_box), GTK_WIDGET (l->data));
g_list_free (list);
list = gdk_display_list_seats (gen->priv->display);

View File

@ -326,11 +326,14 @@ update_info (gpointer data)
if (GTK_IS_WIDGET (sl->priv->object))
{
GtkWidget *child;
AtkObject *accessible;
AtkRole role;
GList *list, *l;
gtk_container_forall (GTK_CONTAINER (sl->priv->mnemonic_label), (GtkCallback)gtk_widget_destroy, NULL);
while ((child = gtk_widget_get_first_child (sl->priv->mnemonic_label)))
gtk_container_remove (GTK_CONTAINER (sl->priv->mnemonic_label), child);
list = gtk_widget_list_mnemonic_labels (GTK_WIDGET (sl->priv->object));
for (l = list; l; l = l->next)
{

View File

@ -600,8 +600,8 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
pl->priv->object = object;
while ((w = gtk_widget_get_first_child (pl->priv->list2)) != NULL)
gtk_widget_destroy (w);
while ((w = gtk_widget_get_first_child (pl->priv->list2)))
gtk_container_remove (GTK_CONTAINER (pl->priv->list2), w);
for (i = 0; i < num_properties; i++)
{

View File

@ -1179,7 +1179,7 @@ node_property_activated (GtkTreeView *tv,
gtk_popover_set_child (GTK_POPOVER (popover), image);
gtk_popover_popup (GTK_POPOVER (popover));
g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_unparent), NULL);
g_object_unref (texture);
}

View File

@ -49,7 +49,10 @@ static void
remove_string (GtkButton *button,
GtkInspectorStrvEditor *editor)
{
gtk_widget_destroy (gtk_widget_get_parent (GTK_WIDGET (button)));
GtkWidget *row;
row = gtk_widget_get_parent (GTK_WIDGET (button));
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (row)), row);
emit_changed (editor);
}
@ -128,15 +131,13 @@ void
gtk_inspector_strv_editor_set_strv (GtkInspectorStrvEditor *editor,
gchar **strv)
{
GList *children, *l;
GtkWidget *child;
gint i;
editor->blocked = TRUE;
children = gtk_container_get_children (GTK_CONTAINER (editor->box));
for (l = children; l; l = l->next)
gtk_widget_destroy (GTK_WIDGET (l->data));
g_list_free (children);
while ((child = gtk_widget_get_first_child (editor->box)))
gtk_container_remove (GTK_CONTAINER (editor->box), child);
if (strv)
{

View File

@ -99,7 +99,7 @@ less_gears (GtkButton *button, gpointer data)
gears = gtk_widget_get_last_child (GTK_WIDGET (container));
if (gears)
gtk_widget_destroy (gears);
gtk_container_remove (container, gears);
}
static void

View File

@ -79,7 +79,7 @@ create_tree_blaat (void)
2, FALSE,
-1);
gtk_widget_destroy (cellview);
g_object_unref (g_object_ref_sink (cellview));
return GTK_TREE_MODEL (store);
}
@ -101,7 +101,7 @@ create_empty_list_blaat (void)
1, "dialog-warning",
-1);
gtk_widget_destroy (cellview);
g_object_unref (g_object_ref_sink (cellview));
return GTK_TREE_MODEL (store);
}
@ -153,7 +153,7 @@ populate_list_blaat (gpointer data)
1, "document-open",
-1);
gtk_widget_destroy (cellview);
g_object_unref (g_object_ref_sink (cellview));
}
static GtkTreeModel *
@ -203,7 +203,7 @@ create_list_blaat (void)
1, "document-open",
-1);
gtk_widget_destroy (cellview);
g_object_unref (g_object_ref_sink (cellview));
return GTK_TREE_MODEL (store);
}

View File

@ -266,8 +266,8 @@ int main (int argc, char *argv[])
gtk_init ();
widget = gtk_color_button_new ();
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);

View File

@ -40,7 +40,7 @@ row_revealed (GObject *revealer, GParamSpec *pspec, gpointer data)
child = gtk_revealer_get_child (GTK_REVEALER (revealer));
g_object_ref (child);
gtk_revealer_set_child (GTK_REVEALER (revealer), NULL);
gtk_widget_destroy (GTK_WIDGET (revealer));
gtk_widget_unparent (GTK_WIDGET (revealer));
gtk_container_add (GTK_CONTAINER (row), child);
g_object_unref (child);
}

View File

@ -41,8 +41,8 @@ test_popover_parent (void)
g_assert (atk_object_get_parent (a) != NULL);
gtk_widget_destroy (w);
gtk_widget_destroy (p);
gtk_widget_unparent (w);
g_object_unref (g_object_ref_sink (p));
}
int

View File

@ -101,7 +101,7 @@ do_action (GtkBuilder *builder, const gchar *action, GString *string)
GObject *o;
o = gtk_builder_get_object (builder, parts[i]);
gtk_widget_destroy (GTK_WIDGET (o));
g_object_unref (o);
}
}
else if (strcmp (parts[0], "show") == 0)

View File

@ -185,7 +185,7 @@ test_text (void)
g_assert_cmpint (visibility_changed, ==, 1);
gtk_widget_destroy (box);
g_object_unref (g_object_ref_sink (box));
g_object_unref (clipboard_actions);
}
@ -425,7 +425,7 @@ test_enabled (void)
g_assert_cmpint (toggled, ==, 1);
gtk_widget_destroy (text);
g_object_unref (g_object_ref_sink (text));
}
int

View File

@ -483,7 +483,7 @@ filter_test_teardown (FilterTest *fixture,
{
signal_monitor_free (fixture->monitor);
gtk_widget_destroy (fixture->tree_view);
g_object_unref (g_object_ref_sink (fixture->tree_view));
g_object_unref (fixture->filter);
g_object_unref (fixture->store);
@ -2421,7 +2421,7 @@ insert_before (void)
g_object_unref (filter);
g_object_unref (store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
static void
@ -2484,7 +2484,7 @@ insert_child (void)
g_object_unref (filter);
g_object_unref (store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
@ -2514,7 +2514,7 @@ remove_node (void)
gtk_list_store_remove (list, &iter3);
gtk_list_store_remove (list, &iter2);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
g_object_unref (filter);
g_object_unref (list);
}
@ -2552,7 +2552,7 @@ remove_node_vroot (void)
gtk_tree_store_remove (tree, &iter3);
gtk_tree_store_remove (tree, &iter2);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
g_object_unref (filter);
g_object_unref (tree);
}
@ -2588,7 +2588,7 @@ remove_vroot_ancestor (void)
gtk_tree_store_remove (tree, &parent);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
g_object_unref (filter);
g_object_unref (tree);
}
@ -2622,7 +2622,7 @@ ref_count_single_level (void)
assert_node_ref_count (ref_model, &iter[3], 1);
assert_node_ref_count (ref_model, &iter[4], 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_node_ref_count (ref_model, &iter[0], 1);
assert_node_ref_count (ref_model, &iter[1], 0);
@ -2692,7 +2692,7 @@ ref_count_two_levels (void)
assert_node_ref_count (ref_model, &iter_first, 1);
assert_node_ref_count (ref_model, &iter, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_root_level_referenced (ref_model, 1);
assert_node_ref_count (ref_model, &iter_first, 1);
@ -2864,7 +2864,7 @@ ref_count_three_levels (void)
assert_node_ref_count (ref_model, &iter_parent2_first, 0);
assert_node_ref_count (ref_model, &iter_parent2, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
@ -2963,7 +2963,7 @@ ref_count_delete_row (void)
assert_node_ref_count (ref_model, &grandparent1, 2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &grandparent1, 1);
@ -3068,7 +3068,7 @@ ref_count_filter_row_length_1 (void)
assert_node_ref_count (ref_model, &level3_1, 0);
assert_node_ref_count (ref_model, &level4_1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &level1_1, 2);
@ -3145,7 +3145,7 @@ ref_count_filter_row_length_1_remove_in_root_level (void)
assert_node_ref_count (ref_model, &level3_1, 0);
assert_node_ref_count (ref_model, &level4_1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &level1_1, 2);
@ -3227,7 +3227,7 @@ ref_count_filter_row_length_1_remove_in_child_level (void)
assert_node_ref_count (ref_model, &level3_1, 0);
assert_node_ref_count (ref_model, &level4_1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &level1_1, 2);
@ -3370,7 +3370,7 @@ ref_count_filter_row_length_gt_1 (void)
assert_node_ref_count (ref_model, &level4_1, 0);
assert_node_ref_count (ref_model, &level4_2, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &level1_1, 1);
@ -3470,7 +3470,7 @@ ref_count_filter_row_length_gt_1_visible_children (void)
assert_node_ref_count (ref_model, &level4_1, 0);
assert_node_ref_count (ref_model, &level4_2, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
assert_node_ref_count (ref_model, &level1_1, 1);
@ -3539,7 +3539,7 @@ ref_count_cleanup (void)
assert_node_ref_count (ref_model, &iter_parent2_first, 2);
assert_node_ref_count (ref_model, &iter_parent2, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_node_ref_count (ref_model, &grandparent1, 1);
assert_node_ref_count (ref_model, &grandparent2, 1);
@ -3651,7 +3651,7 @@ ref_count_row_ref (void)
assert_node_ref_count (ref_model, &parent1, 1);
assert_node_ref_count (ref_model, &iter_parent1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
gtk_tree_model_filter_clear_cache (GTK_TREE_MODEL_FILTER (filter_model));
@ -3704,7 +3704,7 @@ ref_count_transfer_root_level_insert (void)
assert_node_ref_count (ref_model, &grandparent2, 1);
assert_node_ref_count (ref_model, &grandparent3, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -3746,7 +3746,7 @@ ref_count_transfer_root_level_remove (void)
assert_node_ref_count (ref_model, &grandparent3, 2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -3823,7 +3823,7 @@ ref_count_transfer_root_level_remove_filtered (void)
check_level_length (GTK_TREE_MODEL_FILTER (filter_model), NULL, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -3864,7 +3864,7 @@ ref_count_transfer_root_level_reordered (void)
assert_node_ref_count (ref_model, &grandparent3, 1);
assert_node_ref_count (ref_model, &grandparent1, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -3965,7 +3965,7 @@ ref_count_transfer_root_level_reordered_filtered (void)
assert_node_ref_count (ref_model, &grandparent2, 0);
assert_node_ref_count (ref_model, &grandparent1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4099,7 +4099,7 @@ ref_count_transfer_root_level_filter (void)
gtk_tree_store_set (GTK_TREE_STORE (model), &grandparent4, 0, TRUE, -1);
gtk_tree_store_remove (GTK_TREE_STORE (model), &grandparent2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4145,7 +4145,7 @@ ref_count_transfer_child_level_insert (void)
assert_node_ref_count (ref_model, &parent2, 0);
assert_node_ref_count (ref_model, &parent3, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4193,7 +4193,7 @@ ref_count_transfer_child_level_remove (void)
assert_node_ref_count (ref_model, &grandparent1, 3);
assert_node_ref_count (ref_model, &parent3, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4280,7 +4280,7 @@ ref_count_transfer_child_level_remove_filtered (void)
check_level_length (GTK_TREE_MODEL_FILTER (filter_model), "0", 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4326,7 +4326,7 @@ ref_count_transfer_child_level_reordered (void)
assert_node_ref_count (ref_model, &parent3, 0);
assert_node_ref_count (ref_model, &parent1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4436,7 +4436,7 @@ ref_count_transfer_child_level_reordered_filtered (void)
assert_node_ref_count (ref_model, &parent2, 0);
assert_node_ref_count (ref_model, &parent1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -4574,7 +4574,7 @@ ref_count_transfer_child_level_filter (void)
gtk_tree_store_set (GTK_TREE_STORE (model), &grandparent4, 0, TRUE, -1);
gtk_tree_store_remove (GTK_TREE_STORE (model), &grandparent2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -5012,7 +5012,7 @@ specific_has_child_filter (void)
g_object_unref (fixture.filter);
g_object_unref (fixture.store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
@ -5176,7 +5176,7 @@ specific_root_has_child_filter (void)
g_object_unref (fixture.filter);
g_object_unref (fixture.store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
static void
@ -5286,7 +5286,7 @@ specific_has_child_filter_on_sort_model (void)
g_object_unref (fixture.filter);
g_object_unref (fixture.store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
static gboolean
@ -5407,7 +5407,7 @@ specific_at_least_2_children_filter (void)
g_object_unref (fixture.filter);
g_object_unref (fixture.store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
static void
@ -5488,7 +5488,7 @@ specific_at_least_2_children_filter_on_sort_model (void)
gtk_tree_row_reference_free (ref);
g_object_unref (fixture.filter);
g_object_unref (fixture.store);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
@ -5948,7 +5948,7 @@ specific_bug_311955_clean (void)
check_level_length (GTK_TREE_MODEL_FILTER (filter), "0", 3);
check_level_length (GTK_TREE_MODEL_FILTER (filter), "0:2", 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
}
static void
@ -6467,7 +6467,7 @@ specific_bug_657353_related (void)
assert_node_ref_count (ref_model, &node2, 2);
assert_node_ref_count (ref_model, &node4, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (ref_model);
}
@ -6545,7 +6545,7 @@ specific_bug_657353 (void)
*/
gtk_list_store_set (store, &iter_c, 0, "CCC hidden", -1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter_model);
g_object_unref (sort_model);
g_object_unref (store);
@ -6624,7 +6624,7 @@ specific_bug_659022_row_changed_emission (void)
gtk_tree_model_row_changed (model, path, &child);
gtk_tree_path_free (path);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter);
g_object_unref (model);
}
@ -6660,7 +6660,7 @@ specific_bug_659022_row_deleted_node_invisible (void)
gtk_tree_store_remove (GTK_TREE_STORE (model), &parent);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter);
g_object_unref (model);
}
@ -6723,7 +6723,7 @@ specific_bug_659022_row_deleted_free_level (void)
gtk_tree_store_remove (GTK_TREE_STORE (model), &parent2);
gtk_tree_store_remove (GTK_TREE_STORE (model), &parent);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (filter);
g_object_unref (model);
}

View File

@ -457,7 +457,7 @@ test_phases (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -516,7 +516,7 @@ test_mixed (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -571,7 +571,7 @@ test_early_exit (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -618,7 +618,7 @@ test_claim_capture (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -665,7 +665,7 @@ test_claim_target (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -718,7 +718,7 @@ test_claim_bubble (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -775,7 +775,7 @@ test_early_claim_capture (void)
point_release (&mouse_state, 1);
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -834,7 +834,7 @@ test_late_claim_capture (void)
point_release (&mouse_state, 1);
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -886,7 +886,7 @@ test_group (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -945,8 +945,8 @@ test_gestures_outside_grab (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_widget_destroy (D);
gtk_window_destroy (A);
gtk_window_destroy (D);
}
static void
@ -1006,7 +1006,7 @@ test_gestures_inside_grab (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -1057,7 +1057,7 @@ test_multitouch_on_single (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -1132,7 +1132,7 @@ test_multitouch_activation (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
static void
@ -1225,7 +1225,7 @@ test_multitouch_interaction (void)
g_string_free (str, TRUE);
gtk_widget_destroy (A);
gtk_window_destroy (A);
}
int

View File

@ -61,7 +61,7 @@ test_list_reference_during_creation (void)
assert_root_level_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_root_level_unreferenced (ref_model);
@ -96,7 +96,7 @@ test_list_reference_after_creation (void)
assert_root_level_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_root_level_unreferenced (ref_model);
@ -136,7 +136,7 @@ test_list_reference_reordered (void)
assert_root_level_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_root_level_unreferenced (ref_model);
@ -199,7 +199,7 @@ test_tree_reference_during_creation (void)
assert_not_entire_model_referenced (ref_model, 1);
assert_level_unreferenced (ref_model, &child);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -237,7 +237,7 @@ test_tree_reference_after_creation (void)
assert_not_entire_model_referenced (ref_model, 1);
assert_level_unreferenced (ref_model, &child);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -280,7 +280,7 @@ test_tree_reference_reordered (void)
assert_entire_model_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -330,7 +330,7 @@ test_tree_reference_expand_all (void)
assert_not_entire_model_referenced (ref_model, 1);
assert_level_unreferenced (ref_model, &child);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -373,7 +373,7 @@ test_tree_reference_collapse_all (void)
assert_not_entire_model_referenced (ref_model, 1);
assert_level_unreferenced (ref_model, &child);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -440,7 +440,7 @@ test_tree_reference_expand_collapse (void)
gtk_tree_path_free (path1);
gtk_tree_path_free (path2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (ref_model);
}
@ -486,7 +486,7 @@ test_row_reference_list (void)
assert_node_ref_count (ref_model, &iter1, 2);
assert_node_ref_count (ref_model, &iter2, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_node_ref_count (ref_model, &iter0, 0);
assert_node_ref_count (ref_model, &iter1, 1);
@ -670,7 +670,7 @@ test_row_reference_tree (void)
assert_node_ref_count (ref_model, &child2, 0);
assert_node_ref_count (ref_model, &grandchild2, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_node_ref_count (ref_model, &iter0, 0);
assert_node_ref_count (ref_model, &child0, 0);
@ -927,7 +927,7 @@ test_row_reference_tree_expand (void)
gtk_tree_row_reference_free (row_ref1);
gtk_tree_row_reference_free (row_ref2);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (ref_model);
}

View File

@ -126,7 +126,7 @@ create_widget_tree (void)
static void
destroy_widgets (void)
{
g_slist_free_full (widgets, (GDestroyNotify) gtk_widget_destroy);
g_slist_free_full (widgets, (GDestroyNotify) gtk_window_destroy);
widgets = NULL;
}

View File

@ -46,7 +46,7 @@ ref_count_single_level (void)
assert_entire_model_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -97,7 +97,7 @@ ref_count_two_levels (void)
assert_root_level_referenced (ref_model, 1);
assert_node_ref_count (ref_model, &iter, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -238,7 +238,7 @@ ref_count_three_levels (void)
assert_node_ref_count (ref_model, &iter_parent1, 0);
assert_node_ref_count (ref_model, &iter_parent2, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -323,7 +323,7 @@ ref_count_delete_row (void)
assert_node_ref_count (ref_model, &grandparent1, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_entire_model_unreferenced (ref_model);
@ -366,7 +366,7 @@ ref_count_cleanup (void)
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
assert_node_ref_count (ref_model, &grandparent1, 0);
assert_node_ref_count (ref_model, &grandparent2, 1);
@ -471,7 +471,7 @@ ref_count_row_ref (void)
assert_node_ref_count (ref_model, &parent1, 0);
assert_node_ref_count (ref_model, &iter_parent1, 0);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
assert_entire_model_unreferenced (ref_model);
@ -563,7 +563,7 @@ ref_count_reorder_single (void)
assert_entire_model_referenced (ref_model, 1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
assert_entire_model_unreferenced (ref_model);
@ -724,7 +724,7 @@ ref_count_reorder_two (void)
assert_level_referenced (ref_model, 1, &iter1);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
assert_entire_model_unreferenced (ref_model);
@ -843,7 +843,7 @@ rows_reordered_single_level (void)
gtk_tree_path_free (path);
signal_monitor_free (monitor);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
assert_entire_model_unreferenced (ref_model);
@ -951,7 +951,7 @@ rows_reordered_two_levels (void)
gtk_tree_path_free (child_path);
signal_monitor_free (monitor);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
g_object_unref (ref_model);
@ -1023,7 +1023,7 @@ sorted_insert (void)
gtk_tree_path_free (path);
signal_monitor_free (monitor);
gtk_widget_destroy (tree_view);
g_object_unref (g_object_ref_sink (tree_view));
g_object_unref (sort_model);
g_object_unref (ref_model);

View File

@ -111,7 +111,7 @@ test_info_bar_basic (void)
infobar = gtk_info_bar_new ();
g_assert (GTK_IS_INFO_BAR (infobar));
gtk_widget_destroy (infobar);
g_object_unref (g_object_ref_sink (infobar));
}
static void
@ -123,7 +123,7 @@ test_lock_button_basic (void)
permission = g_simple_permission_new (TRUE);
button = gtk_lock_button_new (permission);
g_assert (GTK_IS_LOCK_BUTTON (button));
gtk_widget_destroy (button);
g_object_unref (g_object_ref_sink (button));
g_object_unref (permission);
}
@ -155,7 +155,7 @@ test_scale_button_basic (void)
widget = gtk_scale_button_new (0, 100, 10, NULL);
g_assert (GTK_IS_SCALE_BUTTON (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -165,7 +165,7 @@ test_volume_button_basic (void)
widget = gtk_volume_button_new ();
g_assert (GTK_IS_VOLUME_BUTTON (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -175,7 +175,7 @@ test_statusbar_basic (void)
widget = gtk_statusbar_new ();
g_assert (GTK_IS_STATUSBAR (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -185,7 +185,7 @@ test_search_bar_basic (void)
widget = gtk_search_bar_new ();
g_assert (GTK_IS_SEARCH_BAR (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -195,7 +195,7 @@ test_action_bar_basic (void)
widget = gtk_action_bar_new ();
g_assert (GTK_IS_ACTION_BAR (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -205,7 +205,7 @@ test_app_chooser_widget_basic (void)
widget = gtk_app_chooser_widget_new (NULL);
g_assert (GTK_IS_APP_CHOOSER_WIDGET (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -288,7 +288,7 @@ test_file_chooser_widget_basic (void)
while (!done)
g_main_context_iteration (NULL, TRUE);
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -344,7 +344,7 @@ test_file_chooser_button_basic (void)
while (!done)
g_main_context_iteration (NULL, TRUE);
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -354,7 +354,7 @@ test_font_button_basic (void)
widget = gtk_font_button_new ();
g_assert (GTK_IS_FONT_BUTTON (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void
@ -364,7 +364,7 @@ test_font_chooser_widget_basic (void)
widget = gtk_font_chooser_widget_new ();
g_assert (GTK_IS_FONT_CHOOSER_WIDGET (widget));
gtk_widget_destroy (widget);
g_object_unref (g_object_ref_sink (widget));
}
static void

View File

@ -68,7 +68,7 @@ test_bug_546005 (void)
NULL, FALSE);
gtk_tree_path_free (path);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
}
static void
@ -99,7 +99,7 @@ test_bug_539377 (void)
g_assert (gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (view), 10, 10,
&path, NULL) == FALSE);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
}
static void
@ -155,7 +155,7 @@ test_select_collapsed_row (void)
gtk_tree_path_free (path);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
}
static gboolean
@ -192,7 +192,6 @@ test_row_separator_height (void)
gtk_list_store_insert_with_values (store, &iter, 3, 0, "Row content", -1);
gtk_list_store_insert_with_values (store, &iter, 4, 0, "Row content", -1);
/*window = gtk_invisible_new ();*/
window = gtk_window_new ();
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
@ -225,7 +224,7 @@ test_row_separator_height (void)
g_assert_cmpint (rect.height, ==, height);
g_assert_cmpint (cell_rect.height, ==, height);
gtk_widget_destroy (window);
gtk_window_destroy (GTK_WINDOW (window));
}
static void
@ -278,7 +277,7 @@ test_selection_count (void)
g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
}
static void
@ -332,7 +331,7 @@ test_selection_empty (void)
gtk_tree_path_free (path);
gtk_widget_destroy (view);
g_object_unref (g_object_ref_sink (view));
}
int