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-03-12 18:15:40 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-12 18:15:40 +0300
commita5e59ede6e275d89fb74ab2e2ae1ee581e08356b (patch)
tree16f9ff2f605108147d1ef2c88975f4c93b419408 /source/blender
parentf6b21ecf840627f384c84e1a869ca54698792a87 (diff)
pass report list along to BLO_blendhandle_from_file(), avoid unlikely crash in the append operator.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/BLO_readfile.h4
-rw-r--r--source/blender/blenloader/intern/readblenentry.c4
-rw-r--r--source/blender/editors/space_file/filelist.c4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c15
4 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index f890f169eec..bbe444eff5c 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -120,11 +120,13 @@ BLO_blendfiledata_free(
* Open a blendhandle from a file path.
*
* @param file The file path to open.
+ * @param reports Report errors in opening the file (can be NULL).
* @return A handle on success, or NULL on failure.
*/
BlendHandle*
BLO_blendhandle_from_file(
- char *file);
+ char *file,
+ struct ReportList *reports);
/**
* Open a blendhandle from memory.
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 4a8ef3a9317..ae4ba6629a6 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -75,11 +75,11 @@ void BLO_blendhandle_print_sizes(BlendHandle *, void *);
/* Access routines used by filesel. */
-BlendHandle *BLO_blendhandle_from_file(char *file)
+BlendHandle *BLO_blendhandle_from_file(char *file, ReportList *reports)
{
BlendHandle *bh;
- bh= (BlendHandle*)blo_openblenderfile(file, NULL);
+ bh= (BlendHandle*)blo_openblenderfile(file, reports);
return bh;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 0eee8eb0712..42efa5d4a3b 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -986,7 +986,7 @@ void filelist_from_library(struct FileList* filelist)
/* there we go */
/* for the time being only read filedata when libfiledata==0 */
if (filelist->libfiledata == NULL) {
- filelist->libfiledata= BLO_blendhandle_from_file(dir);
+ filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
if(filelist->libfiledata == NULL) return;
}
@@ -1000,7 +1000,7 @@ void filelist_from_library(struct FileList* filelist)
names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
/* ugh, no rewind, need to reopen */
BLO_blendhandle_close(filelist->libfiledata);
- filelist->libfiledata= BLO_blendhandle_from_file(dir);
+ filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
} else {
names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b7c41052510..6ca7de943cf 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1548,12 +1548,23 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ bh = BLO_blendhandle_from_file(libname, op->reports);
+
+ if(bh == NULL) {
+ /* unlikely since we just browsed it, but possible
+ * error reports will have been made by BLO_blendhandle_from_file() */
+ return OPERATOR_CANCELLED;
+ }
+
+
+ /* from here down, no error returns */
+
+ idcode = BKE_idcode_from_name(group);
+
/* now we have or selected, or an indicated file */
if(RNA_boolean_get(op->ptr, "autoselect"))
scene_deselect_all(scene);
- bh = BLO_blendhandle_from_file(libname);
- idcode = BKE_idcode_from_name(group);
flag = wm_link_append_flag(op);