Skip to content

Commit

Permalink
Merge branch 'aggraef/purr-data-osx-prefs-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Wilkes committed Jul 27, 2017
2 parents acd148a + 890310e commit 1f41004
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pd/src/s_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ static char *sys_prefbuf;
// prefs is *much* faster now than with the previous method which invoked
// 'defaults read' on each individual key.

static int save_prefs_later = 0;

static void sys_initloadpreferences(void)
{
char cmdbuf[MAXPDSTRING], *buf;
Expand Down Expand Up @@ -308,6 +310,8 @@ static void sys_initloadpreferences(void)
// Read from the package defaults and write to the user prefs.
prefs = default_prefs;
strncpy(current_prefs, user_prefs, FILENAME_MAX);
// AG: Remember to save the prefs later after we loaded them (see below).
save_prefs_later = 1;
}
// This looks complicated, but is rather straightforward. The individual
// stages of the pipe are:
Expand Down Expand Up @@ -405,6 +409,14 @@ static void sys_doneloadpreferences( void)
if (sys_prefbuf)
free(sys_prefbuf);
sys_prefbuf = NULL;
if (save_prefs_later) {
// AG: We need to save the default prefs to the user prefs at this point
// in order to avoid losing them, in case the recent file list is written
// without first saving the defaults (fixes #339).
extern void glob_savepreferences(t_pd *dummy);
glob_savepreferences(NULL);
save_prefs_later = 0;
}
}

// AG: We use a similar approach here to import the data into the defaults
Expand Down

0 comments on commit 1f41004

Please sign in to comment.