[evolution] EHTMLEditor - Don't leak the WebKitDOMHTMLCollection objects



commit bb6fc1c4b05f8d120363679db644e51fd69b1752
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Mar 6 08:20:05 2015 +0100

    EHTMLEditor - Don't leak the WebKitDOMHTMLCollection objects

 e-util/e-html-editor-actions.c      |    5 ++++-
 e-util/e-html-editor-cell-dialog.c  |   10 ++++++++++
 e-util/e-html-editor-table-dialog.c |    8 ++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index a199eab..c40df25 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -201,7 +201,9 @@ action_context_delete_column_cb (GtkAction *action,
 
                webkit_dom_html_table_row_element_delete_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), index, NULL);
+               g_object_unref (row);
        }
+       g_object_unref (rows);
 }
 
 static void
@@ -338,7 +340,7 @@ action_context_insert_row_above_cb (GtkAction *action,
                webkit_dom_html_table_row_element_insert_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (new_row), -1, NULL);
        }
-
+       g_object_unref (cells);
 }
 
 static void
@@ -371,6 +373,7 @@ action_context_insert_row_below_cb (GtkAction *action,
                webkit_dom_html_table_row_element_insert_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (new_row), -1, NULL);
        }
+       g_object_unref (cells);
 }
 
 static void
diff --git a/e-util/e-html-editor-cell-dialog.c b/e-util/e-html-editor-cell-dialog.c
index 91da7df..a70f0ce 100644
--- a/e-util/e-html-editor-cell-dialog.c
+++ b/e-util/e-html-editor-cell-dialog.c
@@ -122,7 +122,9 @@ for_each_cell_do (WebKitDOMElement *row,
 
                call_cell_dom_func (
                        WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (cell), func, value, user_data);
+               g_object_unref (cell);
        }
+       g_object_unref (cells);
 }
 
 static void
@@ -162,13 +164,19 @@ html_editor_cell_dialog_set_attribute (EHTMLEditorCellDialog *dialog,
                                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row));
                        cell = webkit_dom_html_collection_item (cells, index);
                        if (!cell) {
+                               g_object_unref (row);
+                               g_object_unref (cells);
                                continue;
                        }
 
                        call_cell_dom_func (
                                WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (cell),
                                func, value, user_data);
+                       g_object_unref (row);
+                       g_object_unref (cells);
+                       g_object_unref (cell);
                }
+               g_object_unref (rows);
 
        } else if (dialog->priv->scope == SCOPE_ROW) {
                WebKitDOMElement *row;
@@ -205,7 +213,9 @@ html_editor_cell_dialog_set_attribute (EHTMLEditorCellDialog *dialog,
 
                        for_each_cell_do (
                                WEBKIT_DOM_ELEMENT (row), func, value, user_data);
+                       g_object_unref (row);
                }
+               g_object_unref (rows);
        }
 }
 
diff --git a/e-util/e-html-editor-table-dialog.c b/e-util/e-html-editor-table-dialog.c
index 1ca52b7..2995a29 100644
--- a/e-util/e-html-editor-table-dialog.c
+++ b/e-util/e-html-editor-table-dialog.c
@@ -154,6 +154,7 @@ html_editor_table_dialog_set_row_count (EHTMLEditorTableDialog *dialog)
                                dialog->priv->table_element, -1, NULL);
                }
        }
+       g_object_unref (rows);
 }
 
 static void
@@ -168,6 +169,7 @@ html_editor_table_dialog_get_row_count (EHTMLEditorTableDialog *dialog)
        gtk_spin_button_set_value (
                GTK_SPIN_BUTTON (dialog->priv->rows_edit),
                webkit_dom_html_collection_get_length (rows));
+       g_object_unref (rows);
 }
 
 static void
@@ -205,7 +207,10 @@ html_editor_table_dialog_set_column_count (EHTMLEditorTableDialog *dialog)
                                        row, -1, NULL);
                        }
                }
+               g_object_unref (row);
+               g_object_unref (cells);
        }
+       g_object_unref (rows);
 }
 
 static void
@@ -225,6 +230,9 @@ html_editor_table_dialog_get_column_count (EHTMLEditorTableDialog *dialog)
        gtk_spin_button_set_value (
                GTK_SPIN_BUTTON (dialog->priv->columns_edit),
                webkit_dom_html_collection_get_length (columns));
+       g_object_unref (row);
+       g_object_unref (rows);
+       g_object_unref (columns);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]