[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35922] trunk/blender/source/blender/ editors: Bugfix #26651

Ton Roosendaal ton at blender.org
Thu Mar 31 17:26:52 CEST 2011


Revision: 35922
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35922
Author:   ton
Date:     2011-03-31 15:26:51 +0000 (Thu, 31 Mar 2011)
Log Message:
-----------
Bugfix #26651

If greasepencil became active, making Blender area full or restore
screen from full, the greasepencil handler was still running, using
outdated area pointer. This crashed Blender.

Now greasepencil modal() ends on the case its own stored area does
not exist anymore.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/screen/screen_edit.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-03-31 14:33:59 UTC (rev 35921)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-03-31 15:26:51 UTC (rev 35922)
@@ -1594,6 +1594,18 @@
 	return OPERATOR_RUNNING_MODAL;
 }
 
+/* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */
+static int gpencil_area_exists(bContext *C, ScrArea *satest)
+{
+	bScreen *sc= CTX_wm_screen(C);
+	ScrArea *sa;
+	
+	for(sa= sc->areabase.first; sa; sa= sa->next)
+		if(sa==satest)
+			return 1;
+	return 0;
+}
+
 /* events handling during interactive drawing part of operator */
 static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
 {
@@ -1659,6 +1671,8 @@
 		}
 	}
 	
+	
+	
 	/* handle mode-specific events */
 	if (p->status == GP_STATUS_PAINTING) {
 		/* handle painting mouse-movements? */
@@ -1705,8 +1719,12 @@
 		}
 	}
 	
-	/* update status indicators - cursor, header, etc. */
-	gpencil_draw_status_indicators(p);
+	/* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */
+	if(0==gpencil_area_exists(C, p->sa))
+		estate= OPERATOR_CANCELLED;
+	else
+		/* update status indicators - cursor, header, etc. */
+		gpencil_draw_status_indicators(p);
 	
 	/* process last operations before exiting */
 	switch (estate) {

Modified: trunk/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_edit.c	2011-03-31 14:33:59 UTC (rev 35921)
+++ trunk/blender/source/blender/editors/screen/screen_edit.c	2011-03-31 15:26:51 UTC (rev 35922)
@@ -1585,6 +1585,9 @@
 		   are no longer in the same screen */
 		for(ar=sa->regionbase.first; ar; ar=ar->next)
 			uiFreeBlocks(C, &ar->uiblocks);
+		
+		/* prevent hanging header prints */
+		ED_area_headerprint(sa, NULL);
 	}
 
 	if(sa && sa->full) {




More information about the Bf-blender-cvs mailing list