Skip to content

Commit

Permalink
Fix potential source of crasher bugs
Browse files Browse the repository at this point in the history
Might resolve the crasher bugs mentioned at
https://bugzilla.redhat.com/show_bug.cgi?id=531088
  • Loading branch information
epienbroek committed Feb 10, 2013
1 parent 5dc7c76 commit 2ec7ee5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/mn-text-table.gob
Expand Up @@ -90,14 +90,17 @@ class MN:Text:Table from Mn:Widget
row_free (Row *row (check null)) row_free (Row *row (check null))
{ {
mn_g_ptr_array_free_deep_custom(row->cells, (GFunc) self_cell_free, NULL); mn_g_ptr_array_free_deep_custom(row->cells, (GFunc) self_cell_free, NULL);
row->cells = NULL;
g_free(row); g_free(row);
} }


private void private void
cell_free (MNTextTableCell *cell (check null)) cell_free (MNTextTableCell *cell (check null))
{ {
if (cell->layout) if (cell->layout) {
g_object_unref(cell->layout); g_object_unref(cell->layout);
cell->layout = NULL;
}
g_free(cell); g_free(cell);
} }


Expand Down
31 changes: 17 additions & 14 deletions src/mn-tooltips.gob
Expand Up @@ -88,17 +88,18 @@ class MN:Tooltips from G:Object
GSList *data_list_copy; GSList *data_list_copy;
GSList *l; GSList *l;


if (selfp->timeout_id) if (selfp->timeout_id) {
g_source_remove(selfp->timeout_id); g_source_remove(selfp->timeout_id);
selfp->timeout_id = 0;
}


/* Create a copy of the list to avoid memory corruption as the /* Create a copy of the list to avoid memory corruption as the
* self_widget_remove call removes the item from selfp->data_list */ * self_widget_remove call removes the item from selfp->data_list */
data_list_copy = g_slist_copy(selfp->data_list); data_list_copy = g_slist_copy(selfp->data_list);
MN_LIST_FOREACH(l, data_list_copy) MN_LIST_FOREACH(l, data_list_copy) {
{ TooltipsData *data = l->data;
TooltipsData *data = l->data; self_widget_remove(data->widget, data);
self_widget_remove(data->widget, data); }
}


g_slist_free(data_list_copy); g_slist_free(data_list_copy);
self_unset_window(self); self_unset_window(self);
Expand All @@ -115,7 +116,9 @@ class MN:Tooltips from G:Object


g_object_set_data(G_OBJECT(data->widget), TOOLTIPS_DATA, NULL); g_object_set_data(G_OBJECT(data->widget), TOOLTIPS_DATA, NULL);
g_object_unref(data->widget); g_object_unref(data->widget);
data->widget = NULL;
g_object_unref(data->tip_widget); g_object_unref(data->tip_widget);
data->tip_widget = NULL;
g_free(data); g_free(data);
} }


Expand All @@ -139,11 +142,11 @@ class MN:Tooltips from G:Object
private void private void
unset_window (self) unset_window (self)
{ {
if (selfp->window) if (selfp->window) {
{ self_disconnect_display_closed(self);
self_disconnect_display_closed(self); gtk_widget_destroy(selfp->window);
gtk_widget_destroy(selfp->window); selfp->window = NULL;
} }
} }


private void private void
Expand Down

0 comments on commit 2ec7ee5

Please sign in to comment.