diff options
author | Darin Adler <darin@src.gnome.org> | 2000-09-25 20:10:17 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-09-25 20:10:17 +0000 |
commit | 2a0db776871eb248e7ec10144a4d8b379528d79d (patch) | |
tree | 7710978dbdaad50aa9cdc32168acb8a01c740fc6 | |
parent | 5513ac152806b32321331a6d7b3eac66cd8c15a6 (diff) | |
download | nautilus-2a0db776871eb248e7ec10144a4d8b379528d79d.tar.gz |
Fix double-free problem that was causing a crash on quit if you changed
* libnautilus-extensions/nautilus-theme.c: (load_theme_document),
(nautilus_theme_get_theme_data): Fix double-free problem that was
causing a crash on quit if you changed themes.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-theme.c | 8 | ||||
-rw-r--r-- | libnautilus-private/nautilus-theme.c | 8 |
3 files changed, 18 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2000-09-25 Darin Adler <darin@eazel.com> + + * libnautilus-extensions/nautilus-theme.c: (load_theme_document), + (nautilus_theme_get_theme_data): Fix double-free problem that was + causing a crash on quit if you changed themes. + 2000-09-25 Rebecca Schulman <rebecka@eazel.com> * src/file-manager/nautilus-indexing-info.c: diff --git a/libnautilus-extensions/nautilus-theme.c b/libnautilus-extensions/nautilus-theme.c index b20845e3c..5fe3b7070 100644 --- a/libnautilus-extensions/nautilus-theme.c +++ b/libnautilus-extensions/nautilus-theme.c @@ -79,7 +79,7 @@ load_theme_document (const char * theme_name) char *theme_path, *temp_str; /* formulate the theme path name */ - if (strcmp(theme_name, "default") == 0) { + if (strcmp (theme_name, "default") == 0) { theme_path = nautilus_pixmap_file ("default.xml"); } else { temp_str = g_strdup_printf("%s/%s.xml", theme_name, theme_name); @@ -114,6 +114,7 @@ nautilus_theme_get_theme_data (const char *resource_name, const char *property_n { char *theme_name, *temp_str; char *theme_data; + static gboolean did_set_up_free_last_theme; xmlDocPtr theme_document; xmlNodePtr resource_node; @@ -126,12 +127,15 @@ nautilus_theme_get_theme_data (const char *resource_name, const char *property_n theme_document = last_theme_document; } else { /* release the old saved data, since the theme changed */ + if (!did_set_up_free_last_theme) { + g_atexit (free_last_theme); + did_set_up_free_last_theme = TRUE; + } free_last_theme (); last_theme_name = g_strdup (theme_name); last_theme_document = load_theme_document (theme_name); theme_document = last_theme_document; - g_atexit (free_last_theme); } if (theme_document != NULL) { diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c index b20845e3c..5fe3b7070 100644 --- a/libnautilus-private/nautilus-theme.c +++ b/libnautilus-private/nautilus-theme.c @@ -79,7 +79,7 @@ load_theme_document (const char * theme_name) char *theme_path, *temp_str; /* formulate the theme path name */ - if (strcmp(theme_name, "default") == 0) { + if (strcmp (theme_name, "default") == 0) { theme_path = nautilus_pixmap_file ("default.xml"); } else { temp_str = g_strdup_printf("%s/%s.xml", theme_name, theme_name); @@ -114,6 +114,7 @@ nautilus_theme_get_theme_data (const char *resource_name, const char *property_n { char *theme_name, *temp_str; char *theme_data; + static gboolean did_set_up_free_last_theme; xmlDocPtr theme_document; xmlNodePtr resource_node; @@ -126,12 +127,15 @@ nautilus_theme_get_theme_data (const char *resource_name, const char *property_n theme_document = last_theme_document; } else { /* release the old saved data, since the theme changed */ + if (!did_set_up_free_last_theme) { + g_atexit (free_last_theme); + did_set_up_free_last_theme = TRUE; + } free_last_theme (); last_theme_name = g_strdup (theme_name); last_theme_document = load_theme_document (theme_name); theme_document = last_theme_document; - g_atexit (free_last_theme); } if (theme_document != NULL) { |