Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-12 22:06:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-12 22:06:36 +0400
commit3e7ad0e2714009509004669d8da8ea8c71fa0d04 (patch)
tree9448ca11bb4325aedda01e9aa418b981ebc7d278 /source/blender/blenlib/intern
parentcd0608aff5958e6fc59aad10730255d3cac48622 (diff)
fix [#29537] file/save crashes when target path isnt found
bug was that uiPupMenuSaveOver(...) could run the WM API call function which freed the operator, within the low level invoke function which kept using the freed memory. Changed uiPupMenuSaveOver(...) to only show a popup so the caller needs to check if the file exists and should be immediately written (which was done everywhere except for blend saving anyway). * added note that operators invoke/exec funcs cant call WM_operator_call(...) on themselves, ends up using freed memory. * added BLI_is_file(path), checks the file exists and isnt a directory.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/storage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 1ef254d355f..001b191155d 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -471,6 +471,12 @@ int BLI_is_dir(const char *file)
return S_ISDIR(BLI_exists(file));
}
+int BLI_is_file(const char *path)
+{
+ int mode= BLI_exists(path);
+ return (mode && !S_ISDIR(mode));
+}
+
LinkNode *BLI_file_read_as_lines(const char *name)
{
FILE *fp= fopen(name, "r");