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>2021-06-16 05:30:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-16 05:50:00 +0300
commit2209321f7817f349874cd03003c184408a286511 (patch)
tree73e5e9f71b7687e9b4f7063de1033f6b339afbc0 /source/blender/editors
parentbe8a201a164f8a3ab2e61b1d85bbe75ebfbb0b30 (diff)
Screen: simplify internal logic for new full-screen areas
Creating a new full screen area had it's area initialized as empty, updating the screen then set the area to a 3D view (as a fallback), before the actual area type was set. This made setting the intended space-type run the 3D views exit callback on a 3D view without a View3D struct allocated, which the exit callback needed to account for. Resolve by calling ED_screen_change after the area type has been set.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_screen.h2
-rw-r--r--source/blender/editors/screen/screen_edit.c21
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c5
3 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index bdd7ec571dc..addc3628f9e 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -215,7 +215,7 @@ void ED_screen_restore_temp_type(struct bContext *C, ScrArea *area);
ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *area, int type);
void ED_screen_full_prevspace(struct bContext *C, ScrArea *area);
void ED_screen_full_restore(struct bContext *C, ScrArea *area);
-ScrArea *ED_screen_state_maximized_create(struct bContext *C);
+bScreen *ED_screen_state_maximized_create(struct bContext *C);
struct ScrArea *ED_screen_state_toggle(struct bContext *C,
struct wmWindow *win,
struct ScrArea *area,
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 6cb184a3394..bcfe30a829e 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1275,11 +1275,14 @@ void ED_screen_scene_change(bContext *C, wmWindow *win, Scene *scene)
ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *area, int type)
{
+ bScreen *newscreen = NULL;
ScrArea *newsa = NULL;
SpaceLink *newsl;
if (!area || area->full == NULL) {
- newsa = ED_screen_state_maximized_create(C);
+ newscreen = ED_screen_state_maximized_create(C);
+ newsa = newscreen->areabase.first;
+ BLI_assert(newsa->spacetype == SPACE_EMPTY);
}
if (!newsa) {
@@ -1296,6 +1299,10 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *area, int type)
ED_area_newspace(C, newsa, type, (newsl && newsl->link_flag & SPACE_FLAG_TYPE_TEMPORARY));
+ if (newscreen) {
+ ED_screen_change(C, newscreen);
+ }
+
return newsa;
}
@@ -1361,6 +1368,10 @@ void ED_screen_full_restore(bContext *C, ScrArea *area)
* \param toggle_area: If this is set, its space data will be swapped with the one of the new empty
* area, when toggling back it can be swapped back again.
* \return The newly created screen with the non-normal area.
+ *
+ * \note The caller must run #ED_screen_change this is not done in this function
+ * as it would attempt to initialize areas that don't yet have a space-type assigned
+ * (converting them to 3D view without creating the space-data).
*/
static bScreen *screen_state_to_nonnormal(bContext *C,
wmWindow *win,
@@ -1429,7 +1440,6 @@ static bScreen *screen_state_to_nonnormal(bContext *C,
}
newa->full = oldscreen;
- ED_screen_change(C, screen);
ED_area_tag_refresh(newa);
return screen;
@@ -1442,10 +1452,9 @@ static bScreen *screen_state_to_nonnormal(bContext *C,
* Use this to just create a new maximized screen/area, rather than maximizing an existing one.
* Otherwise, maximize with #ED_screen_state_toggle().
*/
-ScrArea *ED_screen_state_maximized_create(bContext *C)
+bScreen *ED_screen_state_maximized_create(bContext *C)
{
- bScreen *screen = screen_state_to_nonnormal(C, CTX_wm_window(C), NULL, SCREENMAXIMIZED);
- return screen->areabase.first;
+ return screen_state_to_nonnormal(C, CTX_wm_window(C), NULL, SCREENMAXIMIZED);
}
/**
@@ -1548,6 +1557,8 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const
}
screen = screen_state_to_nonnormal(C, win, toggle_area, state);
+
+ ED_screen_change(C, screen);
}
BLI_assert(CTX_wm_screen(C) == screen);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index d560c1f9978..f17cee8056f 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -352,11 +352,6 @@ static void view3d_exit(wmWindowManager *UNUSED(wm), ScrArea *area)
{
BLI_assert(area->spacetype == SPACE_VIEW3D);
View3D *v3d = area->spacedata.first;
- /* Happens when freeing. */
- if (v3d == NULL) {
- return;
- }
-
MEM_SAFE_FREE(v3d->runtime.local_stats);
}