anjuta r4689 - in trunk: . plugins/search
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4689 - in trunk: . plugins/search
- Date: Mon, 2 Feb 2009 21:59:22 +0000 (UTC)
Author: sgranjoux
Date: Mon Feb 2 21:59:22 2009
New Revision: 4689
URL: http://svn.gnome.org/viewvc/anjuta?rev=4689&view=rev
Log:
* plugins/search/search-replace.c,
plugins/search/search-replace_backend.c,
plugins/search/search-replace_backend.h:
Fix #570223 â Replace all in open buffers crashes
Modified:
trunk/ChangeLog
trunk/plugins/search/search-replace.c
trunk/plugins/search/search-replace_backend.c
trunk/plugins/search/search-replace_backend.h
Modified: trunk/plugins/search/search-replace.c
==============================================================================
--- trunk/plugins/search/search-replace.c (original)
+++ trunk/plugins/search/search-replace.c Mon Feb 2 21:59:22 2009
@@ -589,8 +589,6 @@
}
file_buffer_free (fb);
- g_free (se->path);
- g_free (se);
if (SA_SELECT == s->action && nb_results > 0)
break;
@@ -602,8 +600,7 @@
s->range.type == SR_SELECTION)
flag_select = TRUE;
- if (entries)
- g_list_free (entries);
+ free_search_entries (entries);
if (s->action == SA_FIND_PANE)
{
Modified: trunk/plugins/search/search-replace_backend.c
==============================================================================
--- trunk/plugins/search/search-replace_backend.c (original)
+++ trunk/plugins/search/search-replace_backend.c Mon Feb 2 21:59:22 2009
@@ -669,7 +669,13 @@
{
gchar* a_path = ((SearchEntry *) a)->path;
gchar* b_path = ((SearchEntry *) b)->path;
- return strcmp(a_path, b_path);
+ return g_strcmp0(a_path, b_path);
+}
+
+static void search_entry_free (gpointer data, gpointer user_data)
+{
+ g_free (((SearchEntry *)data)->path);
+ g_free (data);
}
/* Create list of search entries */
@@ -808,14 +814,28 @@
{
if (IANJUTA_IS_EDITOR (tmp->data))
{
+ gchar *path = NULL;
+
+ if (IANJUTA_IS_FILE (tmp->data))
+ {
+ GFile *file = ianjuta_file_get_file (IANJUTA_FILE (tmp->data), NULL);
+
+ if (file != NULL)
+ {
+ path = g_file_get_path (file);
+ g_object_unref (file);
+ }
+ }
+
se = g_new0 (SearchEntry, 1);
- se->type = SE_BUFFER;
+ se->type = SE_BUFFER;
se->te = IANJUTA_EDITOR (tmp->data);
- se->direction = SD_FORWARD;
- se->start_pos = 0;
- se->end_pos = -1;
- entries = g_list_prepend(entries, se);
- }
+ se->path = path;
+ se->direction = SD_FORWARD;
+ se->start_pos = 0;
+ se->end_pos = -1;
+ entries = g_list_prepend(entries, se);
+ }
}
entries = g_list_sort(entries, search_entry_compare);
g_list_free (editors);
@@ -867,6 +887,12 @@
return entries;
}
+void free_search_entries (GList *entries)
+{
+ g_list_foreach (entries, search_entry_free, NULL);
+ g_list_free (entries);
+}
+
gchar *
regex_backref (MatchInfo *mi, FileBuffer *fb)
{
Modified: trunk/plugins/search/search-replace_backend.h
==============================================================================
--- trunk/plugins/search/search-replace_backend.h (original)
+++ trunk/plugins/search/search-replace_backend.h Mon Feb 2 21:59:22 2009
@@ -198,6 +198,8 @@
GList *create_search_entries(Search *s);
+void free_search_entries (GList *entries);
+
FileBuffer *file_buffer_new_from_te (IAnjutaEditor *te);
FileBuffer *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]