files: free all the multidata when a file is saved, then recompute it
This fixes https://savannah.gnu.org/bugs/?48103. (The fix is wasteful -- it should only discard the multidata if actually the name *did* change, *and* if the applicable syntax changed.)
This commit is contained in:
@@ -2123,13 +2123,22 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
|
|
||||||
if (!tmp && append == OVERWRITE) {
|
if (!tmp && append == OVERWRITE) {
|
||||||
if (!nonamechange) {
|
if (!nonamechange) {
|
||||||
|
filestruct *line;
|
||||||
|
|
||||||
openfile->filename = mallocstrcpy(openfile->filename,
|
openfile->filename = mallocstrcpy(openfile->filename,
|
||||||
realname);
|
realname);
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
|
/* Discard all the now (possibly) obsolete multidata. */
|
||||||
|
for (line = openfile->fileage; line != NULL; line = line->next) {
|
||||||
|
free(line->multidata);
|
||||||
|
line->multidata = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* We might have changed the filename, so update the colors
|
/* We might have changed the filename, so update the colors
|
||||||
* to account for it, and then make sure we're using them. */
|
* to account for it, and then make sure we're using them. */
|
||||||
color_update();
|
color_update();
|
||||||
color_init();
|
color_init();
|
||||||
|
precalc_multicolorinfo();
|
||||||
|
|
||||||
/* If color syntaxes are available and turned on, we need to
|
/* If color syntaxes are available and turned on, we need to
|
||||||
* call edit_refresh(). */
|
* call edit_refresh(). */
|
||||||
|
|||||||
Reference in New Issue
Block a user