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:
authorJulian Eisel <eiseljulian@gmail.com>2018-04-21 23:03:04 +0300
committerJulian Eisel <eiseljulian@gmail.com>2018-04-21 23:06:27 +0300
commit5ddcfd2456469b138c9fd34f2ec6665afb17e504 (patch)
tree9279c97e9344c028903da4c3f5feb72c685f0246 /source/blender/editors/screen
parent25a529f440873f7ee22671e9c7f251c1a66f8a0d (diff)
Fix crash when opening properties editor
Opening as in activating one in an area that didn't contain a properties editor before.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 53ad1a47cf8..98ec654b420 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1784,6 +1784,7 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exit)
{
if (sa->spacetype != type) {
+ wmWindow *win = CTX_wm_window(C);
SpaceType *st;
SpaceLink *slold;
SpaceLink *sl;
@@ -1809,7 +1810,11 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
sa->spacetype = type;
sa->butspacetype = type;
sa->type = st;
-
+
+ /* If st->new may be called, don't use context until then. The
+ * sa->type->context() callback has changed but data may be invalid
+ * (e.g. with properties editor) until space-data is properly created */
+
/* check previously stored space */
for (sl = sa->spacedata.first; sl; sl = sl->next)
if (sl->spacetype == type)
@@ -1838,7 +1843,9 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
else {
/* new space */
if (st) {
- sl = st->new(sa, CTX_data_scene(C));
+ /* Don't get scene from context here which may depend on space-data. */
+ Scene *scene = WM_window_get_active_scene(win);
+ sl = st->new(sa, scene);
BLI_addhead(&sa->spacedata, sl);
/* swap regions */
@@ -1849,7 +1856,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
}
}
- ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
+ ED_area_initialize(CTX_wm_manager(C), win, sa);
/* tell WM to refresh, cursor types etc */
WM_event_add_mousemove(C);