Commit 66c2bb06 authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

Plug some misc leaks

2008-08-10  Paolo Borelli  <pborelli@katamail.com>

        * gedit/gedit-tab.c:
        * gedit/gedit-utils.c:
        * gedit/gedit-document.c:
        * gedit/gedit-history-entry.c:

        Plug some misc leaks


svn path=/trunk/; revision=6375
parent 9694bbf3
2008-08-10 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-tab.c:
* gedit/gedit-utils.c:
* gedit/gedit-document.c:
* gedit/gedit-history-entry.c:
Plug some misc leaks
2008-08-10 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-document-loader.h:
......
......@@ -672,6 +672,7 @@ get_default_style_scheme (void)
return def_style;
}
static void
gedit_document_init (GeditDocument *doc)
{
......@@ -769,14 +770,19 @@ set_uri (GeditDocument *doc,
{
if (doc->priv->uri != NULL)
{
const gchar *detected_mime;
gchar *content_type;
gchar *detected_mime;
content_type = g_content_type_guess (doc->priv->uri, NULL, 0, NULL);
detected_mime = g_content_type_guess (doc->priv->uri, NULL, 0, NULL);
if (content_type == NULL || g_content_type_is_unknown (content_type))
detected_mime = g_strdup ("text/plain");
else
detected_mime = g_content_type_get_mime_type (content_type);
if (detected_mime == NULL || g_content_type_is_unknown (detected_mime))
detected_mime = "text/plain";
doc->priv->mime_type = detected_mime != NULL ? detected_mime : g_strdup ("text/plain");
doc->priv->mime_type = g_strdup (detected_mime);
g_free (content_type);
}
else
{
......
......@@ -408,8 +408,9 @@ gedit_history_entry_load_history (GeditHistoryEntry *entry)
-1);
}
g_free (key);
g_slist_foreach (gconf_items, (GFunc) g_free, NULL);
g_slist_free (gconf_items);
g_free (key);
}
void
......
......@@ -895,8 +895,8 @@ document_loaded (GeditDocument *document,
GeditTab *tab)
{
GtkWidget *emsg;
gchar *uri;
GFile *location;
gchar *uri;
const GeditEncoding *encoding;
g_return_if_fail ((tab->priv->state == GEDIT_TAB_STATE_LOADING) ||
......@@ -912,8 +912,8 @@ document_loaded (GeditDocument *document,
set_message_area (tab, NULL);
uri = gedit_document_get_uri (document);
location = gedit_document_get_location (document);
uri = gedit_document_get_uri (document);
if (error != NULL)
{
......@@ -969,7 +969,7 @@ document_loaded (GeditDocument *document,
{
g_return_if_fail ((error->domain == G_CONVERT_ERROR) ||
(error->domain == GEDIT_CONVERT_ERROR));
// TODO: different error messages if tab->priv->state == GEDIT_TAB_STATE_REVERTING?
// note that while reverting encoding should be ok, so this is unlikely to happen
emsg = gedit_conversion_error_while_loading_message_area_new (
......@@ -989,6 +989,8 @@ document_loaded (GeditDocument *document,
GTK_RESPONSE_CANCEL);
gtk_widget_show (emsg);
g_object_unref (location);
g_free (uri);
return;
......@@ -1061,6 +1063,7 @@ document_loaded (GeditDocument *document,
}
end:
g_object_unref (location);
g_free (uri);
tab->priv->tmp_line_pos = 0;
......@@ -1662,11 +1665,6 @@ _gedit_tab_get_tooltips (GeditTab *tab)
gchar *uri;
gchar *ruri;
gchar *ruri_markup;
gchar *mime_type;
const gchar *mime_description = NULL;
gchar *mime_full_description;
gchar *encoding;
const GeditEncoding *enc;
g_return_val_if_fail (GEDIT_IS_TAB (tab), NULL);
......@@ -1682,6 +1680,12 @@ _gedit_tab_get_tooltips (GeditTab *tab)
switch (tab->priv->state)
{
gchar *mime_type;
gchar *mime_description;
gchar *mime_full_description;
gchar *encoding;
const GeditEncoding *enc;
case GEDIT_TAB_STATE_LOADING_ERROR:
tip = g_strdup_printf (_("Error opening file %s"),
ruri_markup);
......@@ -1706,6 +1710,7 @@ _gedit_tab_get_tooltips (GeditTab *tab)
mime_full_description = g_strdup_printf ("%s (%s)",
mime_description, mime_type);
g_free (mime_description);
g_free (mime_type);
enc = gedit_document_get_encoding (doc);
......@@ -1724,7 +1729,7 @@ _gedit_tab_get_tooltips (GeditTab *tab)
g_free (encoding);
g_free (mime_full_description);
break;
}
......
......@@ -1238,7 +1238,9 @@ gedit_utils_basename_for_display (gchar const *uri)
g_free (hn_utf8);
g_free (hn);
}
g_object_unref (gfile);
return name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment