Skip to content
Browse files

Fix potential source of crasher bugs

Might resolve the crasher bugs mentioned at
https://bugzilla.redhat.com/show_bug.cgi?id=531088
  • Loading branch information...
1 parent 5dc7c76 commit 2ec7ee5d86d03b0a37e3d71a85d2aa720299b371 @epienbroek committed
Showing with 21 additions and 15 deletions.
  1. +4 −1 src/mn-text-table.gob
  2. +17 −14 src/mn-tooltips.gob
View
5 src/mn-text-table.gob
@@ -90,14 +90,17 @@ class MN:Text:Table from Mn:Widget
row_free (Row *row (check null))
{
mn_g_ptr_array_free_deep_custom(row->cells, (GFunc) self_cell_free, NULL);
+ row->cells = NULL;
g_free(row);
}
private void
cell_free (MNTextTableCell *cell (check null))
{
- if (cell->layout)
+ if (cell->layout) {
g_object_unref(cell->layout);
+ cell->layout = NULL;
+ }
g_free(cell);
}
View
31 src/mn-tooltips.gob
@@ -88,17 +88,18 @@ class MN:Tooltips from G:Object
GSList *data_list_copy;
GSList *l;
- if (selfp->timeout_id)
+ if (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
- * self_widget_remove call removes the item from selfp->data_list */
- data_list_copy = g_slist_copy(selfp->data_list);
- MN_LIST_FOREACH(l, data_list_copy)
- {
- TooltipsData *data = l->data;
- self_widget_remove(data->widget, data);
- }
+ /* Create a copy of the list to avoid memory corruption as the
+ * self_widget_remove call removes the item from selfp->data_list */
+ data_list_copy = g_slist_copy(selfp->data_list);
+ MN_LIST_FOREACH(l, data_list_copy) {
+ TooltipsData *data = l->data;
+ self_widget_remove(data->widget, data);
+ }
g_slist_free(data_list_copy);
self_unset_window(self);
@@ -115,7 +116,9 @@ class MN:Tooltips from G:Object
g_object_set_data(G_OBJECT(data->widget), TOOLTIPS_DATA, NULL);
g_object_unref(data->widget);
+ data->widget = NULL;
g_object_unref(data->tip_widget);
+ data->tip_widget = NULL;
g_free(data);
}
@@ -139,11 +142,11 @@ class MN:Tooltips from G:Object
private void
unset_window (self)
{
- if (selfp->window)
- {
- self_disconnect_display_closed(self);
- gtk_widget_destroy(selfp->window);
- }
+ if (selfp->window) {
+ self_disconnect_display_closed(self);
+ gtk_widget_destroy(selfp->window);
+ selfp->window = NULL;
+ }
}
private void

0 comments on commit 2ec7ee5

Please sign in to comment.
Something went wrong with that request. Please try again.