[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50919] trunk/blender/source/blender/ windowmanager/intern/wm_event_system.c: wm_event_do_handlers was calling sound_sync_scene() twice without error checking the result of the second call.

Campbell Barton ideasman42 at gmail.com
Thu Sep 27 04:18:18 CEST 2012


Revision: 50919
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50919
Author:   campbellbarton
Date:     2012-09-27 02:18:14 +0000 (Thu, 27 Sep 2012)
Log Message:
-----------
wm_event_do_handlers was calling sound_sync_scene() twice without error checking the result of the second call.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-09-26 22:39:10 UTC (rev 50918)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2012-09-27 02:18:14 UTC (rev 50919)
@@ -2021,23 +2021,26 @@
 			Scene *scene = win->screen->scene;
 			
 			if (scene) {
-				int playing = sound_scene_playing(win->screen->scene);
+				int is_playing_sound = sound_scene_playing(win->screen->scene);
 				
-				if (playing != -1) {
+				if (is_playing_sound != -1) {
+					int is_playing_screen;
 					CTX_wm_window_set(C, win);
 					CTX_wm_screen_set(C, win->screen);
 					CTX_data_scene_set(C, scene);
 					
-					if (((playing == 1) && (!ED_screen_animation_playing(wm))) ||
-					    ((playing == 0) && (ED_screen_animation_playing(wm))))
+					is_playing_screen = (ED_screen_animation_playing(wm) != NULL);
+
+					if (((is_playing_sound == 1) && (is_playing_screen == 0)) ||
+					    ((is_playing_sound == 0) && (is_playing_screen == 1)))
 					{
 						ED_screen_animation_play(C, -1, 1);
 					}
 					
-					if (playing == 0) {
-						float time = sound_sync_scene(scene);
+					if (is_playing_sound == 0) {
+						const float time = sound_sync_scene(scene);
 						if (finite(time)) {
-							int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f;
+							int ncfra = time * (float)FPS + 0.5f;
 							if (ncfra != scene->r.cfra) {
 								scene->r.cfra = ncfra;
 								ED_update_for_newframe(CTX_data_main(C), scene, 1);




More information about the Bf-blender-cvs mailing list