gedit r6375 - in trunk: . gedit
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6375 - in trunk: . gedit
- Date: Sun, 10 Aug 2008 13:18:20 +0000 (UTC)
Author: pborelli
Date: Sun Aug 10 13:18:20 2008
New Revision: 6375
URL: http://svn.gnome.org/viewvc/gedit?rev=6375&view=rev
Log:
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
Modified:
trunk/ChangeLog
trunk/gedit/gedit-document.c
trunk/gedit/gedit-history-entry.c
trunk/gedit/gedit-tab.c
trunk/gedit/gedit-utils.c
Modified: trunk/gedit/gedit-document.c
==============================================================================
--- trunk/gedit/gedit-document.c (original)
+++ trunk/gedit/gedit-document.c Sun Aug 10 13:18:20 2008
@@ -672,6 +672,7 @@
return def_style;
}
+
static void
gedit_document_init (GeditDocument *doc)
{
@@ -769,14 +770,19 @@
{
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
{
Modified: trunk/gedit/gedit-history-entry.c
==============================================================================
--- trunk/gedit/gedit-history-entry.c (original)
+++ trunk/gedit/gedit-history-entry.c Sun Aug 10 13:18:20 2008
@@ -408,8 +408,9 @@
-1);
}
- g_free (key);
+ g_slist_foreach (gconf_items, (GFunc) g_free, NULL);
g_slist_free (gconf_items);
+ g_free (key);
}
void
Modified: trunk/gedit/gedit-tab.c
==============================================================================
--- trunk/gedit/gedit-tab.c (original)
+++ trunk/gedit/gedit-tab.c Sun Aug 10 13:18:20 2008
@@ -895,8 +895,8 @@
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 @@
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 @@
{
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 @@
GTK_RESPONSE_CANCEL);
gtk_widget_show (emsg);
+
+ g_object_unref (location);
g_free (uri);
return;
@@ -1061,6 +1063,7 @@
}
end:
+ g_object_unref (location);
g_free (uri);
tab->priv->tmp_line_pos = 0;
@@ -1662,11 +1665,6 @@
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 @@
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 @@
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 @@
g_free (encoding);
g_free (mime_full_description);
-
+
break;
}
Modified: trunk/gedit/gedit-utils.c
==============================================================================
--- trunk/gedit/gedit-utils.c (original)
+++ trunk/gedit/gedit-utils.c Sun Aug 10 13:18:20 2008
@@ -1238,7 +1238,9 @@
g_free (hn_utf8);
g_free (hn);
}
-
+
+ g_object_unref (gfile);
+
return name;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]