mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Once again improve existing filename handling
Several potential problems. - we could end up dereferencing exiting_filename when it was NULL - we could free the default_filename by mistake - subsurface_default_filename always needs to return a copy of it - closing the existing file before opening a new one repopulated the existing_filename with the default filename - preventing the opened file to become the new existing filename Also, make existing filename a const char * and make file_open have the same sensible default folder behavior as the other file related functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fa2f1b6eb0
commit
7148dea827
5 changed files with 23 additions and 12 deletions
|
@ -98,7 +98,7 @@ const char *subsurface_icon_name()
|
|||
const char *subsurface_default_filename()
|
||||
{
|
||||
if (default_filename) {
|
||||
return default_filename;
|
||||
return strdup(default_filename);
|
||||
} else {
|
||||
char datapath[MAX_PATH];
|
||||
const char *user;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue