Fixed some leaks
parent
d90711faed
commit
4b83258c0a
|
@ -330,6 +330,7 @@ moo_edit_class_new_actionv (MooEditClass *klass,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moo_param_array_free ((GParameter*) action_params->data, action_params->len);
|
||||||
g_array_free (action_params, FALSE);
|
g_array_free (action_params, FALSE);
|
||||||
action_params = NULL;
|
action_params = NULL;
|
||||||
|
|
||||||
|
|
|
@ -2289,6 +2289,8 @@ create_statusbar (MooEditWindow *window)
|
||||||
window->priv->cursor_label = moo_glade_xml_get_widget (xml, "cursor");
|
window->priv->cursor_label = moo_glade_xml_get_widget (xml, "cursor");
|
||||||
window->priv->insert_label = moo_glade_xml_get_widget (xml, "insert");
|
window->priv->insert_label = moo_glade_xml_get_widget (xml, "insert");
|
||||||
window->priv->info = moo_glade_xml_get_widget (xml, "info");
|
window->priv->info = moo_glade_xml_get_widget (xml, "info");
|
||||||
|
|
||||||
|
g_object_unref (xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,8 @@ _moo_print_operation_init (MooPrintOperation *print)
|
||||||
gtk_print_operation_set_default_page_setup (GTK_PRINT_OPERATION (print),
|
gtk_print_operation_set_default_page_setup (GTK_PRINT_OPERATION (print),
|
||||||
page_setup);
|
page_setup);
|
||||||
|
|
||||||
|
gtk_print_operation_set_show_progress (GTK_PRINT_OPERATION (print), TRUE);
|
||||||
|
|
||||||
print->last_line = -1;
|
print->last_line = -1;
|
||||||
print->options = MOO_PRINT_USE_STYLES |
|
print->options = MOO_PRINT_USE_STYLES |
|
||||||
MOO_PRINT_HEADER | MOO_PRINT_FOOTER;
|
MOO_PRINT_HEADER | MOO_PRINT_FOOTER;
|
||||||
|
|
|
@ -19,23 +19,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
inline static MooTextStyle*
|
#if GLIB_CHECK_VERSION(2,10,0)
|
||||||
style_new (void)
|
#define style_new() g_slice_new (MooTextStyle)
|
||||||
{
|
#define style_free(s) g_slice_free (MooTextStyle, s)
|
||||||
return g_new (MooTextStyle, 1);
|
#else
|
||||||
}
|
#define style_new() g_new (MooTextStyle, 1)
|
||||||
|
#define style_free g_free
|
||||||
inline static MooTextStyle*
|
#endif
|
||||||
style_new0 (void)
|
|
||||||
{
|
|
||||||
return g_new0 (MooTextStyle, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static void
|
|
||||||
style_free (MooTextStyle *style)
|
|
||||||
{
|
|
||||||
g_free (style);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MooTextStyle*
|
MooTextStyle*
|
||||||
|
|
|
@ -581,6 +581,7 @@ update_timeout (MooTerm *term)
|
||||||
gdk_window_invalidate_region (window, region, FALSE);
|
gdk_window_invalidate_region (window, region, FALSE);
|
||||||
need_redraw = TRUE;
|
need_redraw = TRUE;
|
||||||
|
|
||||||
|
g_free (rectangles);
|
||||||
gdk_region_destroy (region);
|
gdk_region_destroy (region);
|
||||||
gdk_region_destroy (changed);
|
gdk_region_destroy (changed);
|
||||||
|
|
||||||
|
|
|
@ -572,6 +572,12 @@ moo_term_unrealize (GtkWidget *widget)
|
||||||
term->priv->pointer[i] = NULL;
|
term->priv->pointer[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (term->priv->layout)
|
||||||
|
g_object_unref (term->priv->layout);
|
||||||
|
term->priv->layout = NULL;
|
||||||
|
_moo_term_font_free (term->priv->font);
|
||||||
|
term->priv->font = NULL;
|
||||||
|
|
||||||
GTK_WIDGET_CLASS(moo_term_parent_class)->unrealize (widget);
|
GTK_WIDGET_CLASS(moo_term_parent_class)->unrealize (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,6 @@ struct _PackingProps {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MooGladeXMLPrivate {
|
struct _MooGladeXMLPrivate {
|
||||||
MooMarkupDoc *doc;
|
|
||||||
MooMarkupNode *root;
|
|
||||||
GHashTable *widgets;
|
GHashTable *widgets;
|
||||||
char *root_id;
|
char *root_id;
|
||||||
|
|
||||||
|
@ -139,6 +137,8 @@ struct _MooGladeXMLPrivate {
|
||||||
gpointer signal_func_data;
|
gpointer signal_func_data;
|
||||||
MooGladePropFunc prop_func;
|
MooGladePropFunc prop_func;
|
||||||
gpointer prop_func_data;
|
gpointer prop_func_data;
|
||||||
|
|
||||||
|
guint done : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -199,6 +199,7 @@ static void moo_glade_xml_add_widget (MooGladeXML *xml,
|
||||||
static gboolean moo_glade_xml_build (MooGladeXML *xml,
|
static gboolean moo_glade_xml_build (MooGladeXML *xml,
|
||||||
Widget *widget_node,
|
Widget *widget_node,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
|
static void moo_glade_xml_cleanup (MooGladeXML *xml);
|
||||||
|
|
||||||
static gboolean create_child (MooGladeXML *xml,
|
static gboolean create_child (MooGladeXML *xml,
|
||||||
GtkWidget *parent,
|
GtkWidget *parent,
|
||||||
|
@ -1101,11 +1102,12 @@ widget_new (MooGladeXML *xml,
|
||||||
g_return_val_if_fail (child != NULL, NULL);
|
g_return_val_if_fail (child != NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->children = g_slist_append (widget->children, child);
|
widget->children = g_slist_prepend (widget->children, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FOREACH_ELM_END;
|
FOREACH_ELM_END;
|
||||||
|
|
||||||
|
widget->children = g_slist_reverse (widget->children);
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2058,10 +2060,11 @@ moo_glade_xml_parse_markup (MooGladeXML *xml,
|
||||||
{
|
{
|
||||||
MooMarkupNode *glade_elm;
|
MooMarkupNode *glade_elm;
|
||||||
MooMarkupNode *root = NULL;
|
MooMarkupNode *root = NULL;
|
||||||
Widget *widget;
|
Widget *widget = NULL;
|
||||||
|
gboolean result = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (doc != NULL, FALSE);
|
g_return_val_if_fail (doc != NULL, FALSE);
|
||||||
g_return_val_if_fail (xml->priv->doc == NULL, FALSE);
|
g_return_val_if_fail (!xml->priv->done, FALSE);
|
||||||
g_return_val_if_fail (!root_widget || GTK_IS_WIDGET (root_widget), FALSE);
|
g_return_val_if_fail (!root_widget || GTK_IS_WIDGET (root_widget), FALSE);
|
||||||
|
|
||||||
glade_elm = moo_markup_get_root_element (doc, "glade-interface");
|
glade_elm = moo_markup_get_root_element (doc, "glade-interface");
|
||||||
|
@ -2103,40 +2106,32 @@ moo_glade_xml_parse_markup (MooGladeXML *xml,
|
||||||
else
|
else
|
||||||
g_warning ("%s: could not find root element", G_STRLOC);
|
g_warning ("%s: could not find root element", G_STRLOC);
|
||||||
|
|
||||||
return FALSE;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml->priv->doc = moo_markup_doc_ref (doc);
|
widget = widget_new (xml, NULL, root);
|
||||||
xml->priv->root = root;
|
|
||||||
|
|
||||||
widget = widget_new (xml, NULL, xml->priv->root);
|
|
||||||
|
|
||||||
if (!widget)
|
if (!widget)
|
||||||
{
|
goto out;
|
||||||
moo_markup_doc_unref (xml->priv->doc);
|
|
||||||
xml->priv->doc = NULL;
|
|
||||||
xml->priv->root = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_widget (widget);
|
dump_widget (widget);
|
||||||
|
|
||||||
if (!moo_glade_xml_build (xml, widget, root_widget))
|
if (!moo_glade_xml_build (xml, widget, root_widget))
|
||||||
{
|
goto out;
|
||||||
moo_markup_doc_unref (xml->priv->doc);
|
|
||||||
xml->priv->doc = NULL;
|
|
||||||
xml->priv->root = NULL;
|
|
||||||
widget_free (widget);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
gtk_widget_show_all (widget->widget);
|
gtk_widget_show_all (widget->widget);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xml->priv->root_id = g_strdup (widget->id);
|
xml->priv->root_id = g_strdup (widget->id);
|
||||||
|
result = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
out:
|
||||||
|
if (widget)
|
||||||
|
widget_free (widget);
|
||||||
|
moo_glade_xml_cleanup (xml);
|
||||||
|
xml->priv->done = TRUE;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2216,6 +2211,25 @@ moo_glade_xml_add_widget (MooGladeXML *xml,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
moo_glade_xml_cleanup (MooGladeXML *xml)
|
||||||
|
{
|
||||||
|
if (xml->priv->class_to_type)
|
||||||
|
g_hash_table_destroy (xml->priv->class_to_type);
|
||||||
|
if (xml->priv->id_to_type)
|
||||||
|
g_hash_table_destroy (xml->priv->id_to_type);
|
||||||
|
if (xml->priv->id_to_func)
|
||||||
|
g_hash_table_destroy (xml->priv->id_to_func);
|
||||||
|
if (xml->priv->props)
|
||||||
|
g_hash_table_destroy (xml->priv->props);
|
||||||
|
|
||||||
|
xml->priv->class_to_type = NULL;
|
||||||
|
xml->priv->id_to_type = NULL;
|
||||||
|
xml->priv->id_to_func = NULL;
|
||||||
|
xml->priv->props = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unref_widget (G_GNUC_UNUSED gpointer key,
|
unref_widget (G_GNUC_UNUSED gpointer key,
|
||||||
GObject *widget,
|
GObject *widget,
|
||||||
|
@ -2231,14 +2245,10 @@ moo_glade_xml_dispose (GObject *object)
|
||||||
|
|
||||||
if (xml->priv)
|
if (xml->priv)
|
||||||
{
|
{
|
||||||
|
moo_glade_xml_cleanup (xml);
|
||||||
g_hash_table_foreach (xml->priv->widgets,
|
g_hash_table_foreach (xml->priv->widgets,
|
||||||
(GHFunc) unref_widget, xml);
|
(GHFunc) unref_widget, xml);
|
||||||
g_hash_table_destroy (xml->priv->widgets);
|
g_hash_table_destroy (xml->priv->widgets);
|
||||||
g_hash_table_destroy (xml->priv->class_to_type);
|
|
||||||
g_hash_table_destroy (xml->priv->id_to_type);
|
|
||||||
g_hash_table_destroy (xml->priv->id_to_func);
|
|
||||||
g_hash_table_destroy (xml->priv->props);
|
|
||||||
moo_markup_doc_unref (xml->priv->doc);
|
|
||||||
g_free (xml->priv->root_id);
|
g_free (xml->priv->root_id);
|
||||||
g_free (xml->priv);
|
g_free (xml->priv);
|
||||||
xml->priv = NULL;
|
xml->priv = NULL;
|
||||||
|
|
|
@ -1933,6 +1933,7 @@ fill_menu_shell (MooUIXML *xml,
|
||||||
|
|
||||||
check_separators (menu_node, toplevel);
|
check_separators (menu_node, toplevel);
|
||||||
|
|
||||||
|
g_slist_free (children);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2146,6 +2147,7 @@ fill_toolbar (MooUIXML *xml,
|
||||||
|
|
||||||
check_separators (toolbar_node, toplevel);
|
check_separators (toolbar_node, toplevel);
|
||||||
|
|
||||||
|
g_slist_free (children);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2484,6 +2486,8 @@ moo_ui_xml_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
MooUIXML *xml = MOO_UI_XML (object);
|
MooUIXML *xml = MOO_UI_XML (object);
|
||||||
|
|
||||||
|
g_print ("moo_ui_xml_finalize\n");
|
||||||
|
|
||||||
SLIST_FOREACH (xml->priv->toplevels, t)
|
SLIST_FOREACH (xml->priv->toplevels, t)
|
||||||
{
|
{
|
||||||
Toplevel *toplevel = t->data;
|
Toplevel *toplevel = t->data;
|
||||||
|
|
|
@ -1338,6 +1338,8 @@ moo_window_class_new_actionv (MooWindowClass *klass,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moo_param_array_free ((GParameter*) action_params->data,
|
||||||
|
action_params->len);
|
||||||
g_array_free (action_params, FALSE);
|
g_array_free (action_params, FALSE);
|
||||||
action_params = NULL;
|
action_params = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue