mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
open_plugins bugfix failure to save
if you added a plugin through the core settings and then used the shortcut immediately the entry would never get flushed to disk Change-Id: I62e876bbf0a8fa96acba1cc2582e2563401547f1
This commit is contained in:
parent
0501af8b06
commit
3b6c3d769f
2 changed files with 12 additions and 9 deletions
|
@ -49,7 +49,7 @@ static inline void op_clear_entry(struct open_plugin_entry_t *entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int op_update_dat(struct open_plugin_entry_t *entry)
|
static int op_update_dat(struct open_plugin_entry_t *entry, bool clear)
|
||||||
{
|
{
|
||||||
int fd, fd1;
|
int fd, fd1;
|
||||||
uint32_t hash;
|
uint32_t hash;
|
||||||
|
@ -79,7 +79,9 @@ static int op_update_dat(struct open_plugin_entry_t *entry)
|
||||||
|
|
||||||
rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT);
|
rename(OPEN_PLUGIN_DAT ".tmp", OPEN_PLUGIN_DAT);
|
||||||
|
|
||||||
|
if (clear)
|
||||||
op_clear_entry(&open_plugin_entry);
|
op_clear_entry(&open_plugin_entry);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +108,7 @@ uint32_t open_plugin_add_path(const char *key, const char *plugin, const char *p
|
||||||
if(open_plugin_entry.hash != hash)
|
if(open_plugin_entry.hash != hash)
|
||||||
{
|
{
|
||||||
/* the entry in ram needs saved */
|
/* the entry in ram needs saved */
|
||||||
op_update_dat(&open_plugin_entry);
|
op_update_dat(&open_plugin_entry, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin)
|
if (plugin)
|
||||||
|
@ -182,9 +184,9 @@ static int open_plugin_hash_get_entry(uint32_t hash,
|
||||||
if (hash != 0)
|
if (hash != 0)
|
||||||
{
|
{
|
||||||
if(entry->hash == hash) /* hasn't been flushed yet? */
|
if(entry->hash == hash) /* hasn't been flushed yet? */
|
||||||
return 0;
|
return -2;
|
||||||
else
|
else
|
||||||
op_update_dat(&open_plugin_entry);
|
op_update_dat(&open_plugin_entry, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = open(dat_file, O_RDONLY);
|
int fd = open(dat_file, O_RDONLY);
|
||||||
|
@ -232,7 +234,8 @@ int open_plugin_run(const char *key)
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *param;
|
const char *param;
|
||||||
|
|
||||||
open_plugin_get_entry(key, &open_plugin_entry);
|
if (open_plugin_get_entry(key, &open_plugin_entry) == -2) /* entry needs flushed */
|
||||||
|
op_update_dat(&open_plugin_entry, false);
|
||||||
|
|
||||||
path = open_plugin_entry.path;
|
path = open_plugin_entry.path;
|
||||||
param = open_plugin_entry.param;
|
param = open_plugin_entry.param;
|
||||||
|
@ -250,7 +253,7 @@ int open_plugin_run(const char *key)
|
||||||
|
|
||||||
void open_plugin_cache_flush(void)
|
void open_plugin_cache_flush(void)
|
||||||
{
|
{
|
||||||
op_update_dat(&open_plugin_entry);
|
op_update_dat(&open_plugin_entry, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ndef __PCTOOL__ */
|
#endif /* ndef __PCTOOL__ */
|
||||||
|
|
|
@ -848,7 +848,7 @@ void root_menu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open_plugin_get_entry(key, &open_plugin_entry);
|
bool flush = (open_plugin_get_entry(key, &open_plugin_entry) == -2);
|
||||||
char *path = open_plugin_entry.path;
|
char *path = open_plugin_entry.path;
|
||||||
char *param = open_plugin_entry.param;
|
char *param = open_plugin_entry.param;
|
||||||
if (param[0] == '\0')
|
if (param[0] == '\0')
|
||||||
|
@ -856,7 +856,7 @@ void root_menu(void)
|
||||||
|
|
||||||
next_screen = load_plugin_screen(path, param);
|
next_screen = load_plugin_screen(path, param);
|
||||||
|
|
||||||
if (next_screen != GO_TO_PLUGIN)
|
if (!flush && next_screen != GO_TO_PLUGIN)
|
||||||
open_plugin_add_path(NULL, NULL, NULL);
|
open_plugin_add_path(NULL, NULL, NULL);
|
||||||
|
|
||||||
/* shortcuts may take several trips through the GO_TO_PLUGIN case
|
/* shortcuts may take several trips through the GO_TO_PLUGIN case
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue