[Bf-blender-cvs] [d9b6768] master: Fix T44688: Stereo3D time-sequential crashes

Campbell Barton noreply at git.blender.org
Thu May 28 10:46:51 CEST 2015


Commit: d9b67685210275a71bd22b4f8c35590bf795eb47
Author: Campbell Barton
Date:   Thu May 28 18:43:49 2015 +1000
Branches: master
https://developer.blender.org/rBd9b67685210275a71bd22b4f8c35590bf795eb47

Fix T44688: Stereo3D time-sequential crashes

===================================================================

M	source/blender/windowmanager/intern/wm_stereo.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 717583f..6086351 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -452,6 +452,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
 	const bool is_fullscreen = WM_window_is_fullscreen(win);
 	char prev_display_mode = win->stereo3d_format->display_mode;
 	Stereo3dData *s3dd;
+	bool ok = true;
 
 	if (G.background)
 		return OPERATOR_CANCELLED;
@@ -475,6 +476,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
 		else {
 			BKE_report(op->reports, RPT_ERROR,
 			           "Failed to create a window without quad-buffer support, you may experience flickering");
+			ok = false;
 		}
 	}
 	else if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
@@ -489,12 +491,14 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
 				wm_window_close(C, wm, win_new);
 				win->stereo3d_format->display_mode = prev_display_mode;
 				BKE_report(op->reports, RPT_ERROR, "Quad-buffer not supported by the system");
+				ok = false;
 			}
 		}
 		else {
+			win->stereo3d_format->display_mode = prev_display_mode;
 			BKE_report(op->reports, RPT_ERROR,
 			           "Failed to create a window compatible with the time sequential display method");
-			win->stereo3d_format->display_mode = prev_display_mode;
+			ok = false;
 		}
 	}
 
@@ -506,8 +510,15 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
 
 	MEM_freeN(op->customdata);
 
-	WM_event_add_notifier(C, NC_WINDOW, NULL);
-	return OPERATOR_FINISHED;
+	if (ok) {
+		WM_event_add_notifier(C, NC_WINDOW, NULL);
+		return OPERATOR_FINISHED;
+	}
+	else {
+		/* without this, the popup won't be freed freed properly T44688 */
+		CTX_wm_window_set(C, win);
+		return OPERATOR_CANCELLED;
+	}
 }
 
 int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))




More information about the Bf-blender-cvs mailing list