[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54311] trunk/blender/source/blender/ editors/screen/screen_edit.c: fix for valgrind warning - using uninitialized variable.

Campbell Barton ideasman42 at gmail.com
Tue Feb 5 03:28:52 CET 2013


Revision: 54311
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54311
Author:   campbellbarton
Date:     2013-02-05 02:28:49 +0000 (Tue, 05 Feb 2013)
Log Message:
-----------
fix for valgrind warning - using uninitialized variable. Though in practice it didn't cause any problems.

Getting the 'CTX_data_main' while un-fullscreen'ing a space would do a context lookup into the view3d_context which had an uninitialized layer.
since view3d_context doesn't hold a 'main' member it never did anything but cleaner not to do context lookups while modifying the view.
- noticed while checking on a real bug :)

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

Modified: trunk/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_edit.c	2013-02-04 23:50:38 UTC (rev 54310)
+++ trunk/blender/source/blender/editors/screen/screen_edit.c	2013-02-05 02:28:49 UTC (rev 54311)
@@ -1337,13 +1337,14 @@
 /* Do NOT call in area/region queues! */
 void ED_screen_set(bContext *C, bScreen *sc)
 {
+	Main *bmain = CTX_data_main(C);
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *win = CTX_wm_window(C);
 	bScreen *oldscreen = CTX_wm_screen(C);
 	ID *id;
 	
 	/* validate screen, it's called with notifier reference */
-	for (id = CTX_data_main(C)->screen.first; id; id = id->next)
+	for (id = bmain->screen.first; id; id = id->next)
 		if (sc == (bScreen *)id)
 			break;
 	if (id == NULL)
@@ -1355,7 +1356,7 @@
 	
 	if (sc->full) {             /* find associated full */
 		bScreen *sc1;
-		for (sc1 = CTX_data_main(C)->screen.first; sc1; sc1 = sc1->id.next) {
+		for (sc1 = bmain->screen.first; sc1; sc1 = sc1->id.next) {
 			ScrArea *sa = sc1->areabase.first;
 			if (sa->full == sc) {
 				sc = sc1;




More information about the Bf-blender-cvs mailing list