[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6316] fix crash on replacement of displayed file
From: |
Gavin D. Smith |
Subject: |
[6316] fix crash on replacement of displayed file |
Date: |
Sun, 07 Jun 2015 12:49:41 +0000 |
Revision: 6316
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6316
Author: gavin
Date: 2015-06-07 12:49:39 +0000 (Sun, 07 Jun 2015)
Log Message:
-----------
fix crash on replacement of displayed file
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/nodes.c
trunk/info/nodes.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-06-07 12:10:34 UTC (rev 6315)
+++ trunk/ChangeLog 2015-06-07 12:49:39 UTC (rev 6316)
@@ -1,5 +1,13 @@
2015-06-07 Gavin Smith <address@hidden>
+ * info/nodes.c (forget_info_file): Function replaced. Don't
+ free the file buffer because it could still be referenced in a
+ displayed node.
+ * info/Makefile.am (XFAIL_TESTS): Remove replace-viewed.sh.
+ * info/nodes.h (N_Gone): New symbol.
+
+2015-06-07 Gavin Smith <address@hidden>
+
* info/t/replaced-viewed.sh: New test. (Bug reported by Benno
Schulenberg).
* info/Makefile.am (TESTS, XFAIL_TESTS): Add it.
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2015-06-07 12:10:34 UTC (rev 6315)
+++ trunk/info/Makefile.am 2015-06-07 12:49:39 UTC (rev 6316)
@@ -158,7 +158,6 @@
t/help.sh
XFAIL_TESTS = \
- t/replace-viewed.sh \
t/quoted-label-as-target.sh \
t/quoted-target.sh \
t/quoted-label-and-target.sh \
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2015-06-07 12:10:34 UTC (rev 6315)
+++ trunk/info/nodes.c 2015-06-07 12:49:39 UTC (rev 6316)
@@ -542,7 +542,7 @@
static FILE_BUFFER *info_load_file (char *fullpath, int get_tags);
static void get_file_character_encoding (FILE_BUFFER *fb);
-static void forget_info_file (char *filename);
+static void forget_info_file (FILE_BUFFER *file_buffer);
static void info_reload_file_buffer_contents (FILE_BUFFER *fb);
/* Locate the file named by FILENAME, and return the information structure
@@ -578,7 +578,7 @@
{
/* The file has changed. Forget that we ever had loaded it
in the first place. */
- forget_info_file (filename);
+ forget_info_file (file_buffer);
break;
}
@@ -676,7 +676,7 @@
{
/* The file has changed. Forget that we ever had loaded it
in the first place. */
- forget_info_file (fullpath);
+ forget_info_file (file_buffer);
break;
}
return file_buffer;
@@ -800,39 +800,14 @@
return file_buffer;
}
-/* Forget the contents, tags table, nodes list, and names of FILENAME. */
+/* Prevent this file buffer being used again. */
static void
-forget_info_file (char *filename)
+forget_info_file (FILE_BUFFER *file_buffer)
{
- int i;
- FILE_BUFFER *file_buffer;
-
- if (!info_loaded_files)
- return;
-
- for (i = 0; (file_buffer = info_loaded_files[i]); i++)
- if (FILENAME_CMP (filename, file_buffer->filename) == 0
- || FILENAME_CMP (filename, file_buffer->fullpath) == 0)
- {
- free (file_buffer->fullpath);
-
- if (file_buffer->contents)
- free (file_buffer->contents);
-
- /* free_file_buffer_tags () also kills the subfiles list, since
- the subfiles list is only of use in conjunction with tags. */
- free_file_buffer_tags (file_buffer);
-
- /* Move rest of list down. */
- while (info_loaded_files[i + 1])
- {
- info_loaded_files[i] = info_loaded_files[i + 1];
- i++;
- }
- info_loaded_files[i] = 0;
-
- break;
- }
+ file_buffer->flags |= N_Gone;
+ file_buffer->filename = "";
+ file_buffer->fullpath = "";
+ memset (&file_buffer->finfo, 0, sizeof (struct stat));
}
/* Load the contents of FILE_BUFFER->contents. This function is called
Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h 2015-06-07 12:10:34 UTC (rev 6315)
+++ trunk/info/nodes.h 2015-06-07 12:49:39 UTC (rev 6316)
@@ -67,6 +67,7 @@
#define N_IsDir 0x400 /* A dir node. */
#define N_Subfile 0x800 /* File buffer is a subfile of a split file. */
#define N_EOLs_Converted 0x1000 /* CR bytes were stripped before LF. */
+#define N_Gone 0x2000 /* File is no more. */
/* String constants. */
#define INFO_FILE_LABEL "File:"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6316] fix crash on replacement of displayed file,
Gavin D. Smith <=