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-10-22 00:46:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-10-22 02:18:59 +0300
commitbdbaf0301df630cefd3f753c9419646b3f858588 (patch)
tree40edc0bab1425d174e48fcc860e61f405d2b6733 /source/blender/windowmanager/intern/wm_window.c
parentd9ebe25a0cfe107c21a125bd780478afd33fb342 (diff)
Fix crash when creating a new window fails
Also add operator error report.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r--source/blender/windowmanager/intern/wm_window.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index ce0f710f4c2..89f85caa729 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -49,6 +49,7 @@
#include "BKE_icons.h"
#include "BKE_layer.h"
#include "BKE_main.h"
+#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@@ -914,7 +915,7 @@ int wm_window_close_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-int wm_window_new_exec(bContext *C, wmOperator *UNUSED(op))
+int wm_window_new_exec(bContext *C, wmOperator *op)
{
wmWindow *win_src = CTX_wm_window(C);
ScrArea *area = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TYPE_ANY, 0);
@@ -931,16 +932,23 @@ int wm_window_new_exec(bContext *C, wmOperator *UNUSED(op))
false,
WIN_ALIGN_PARENT_CENTER) != NULL);
- return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ if (!ok) {
+ BKE_report(op->reports, RPT_ERROR, "Failed to create window");
+ return OPERATOR_CANCELLED;
+ }
+ return OPERATOR_FINISHED;
}
-int wm_window_new_main_exec(bContext *C, wmOperator *UNUSED(op))
+int wm_window_new_main_exec(bContext *C, wmOperator *op)
{
wmWindow *win_src = CTX_wm_window(C);
bool ok = (wm_window_copy_test(C, win_src, true, false) != NULL);
-
- return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ if (!ok) {
+ BKE_report(op->reports, RPT_ERROR, "Failed to create window");
+ return OPERATOR_CANCELLED;
+ }
+ return OPERATOR_FINISHED;
}
/* fullscreen operator callback */