[chocolate-doom] 01/09: Lock surfaces properly when we have to (fixes crash under Windows 98)

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:06:36 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.0.3
in repository chocolate-doom.

commit 5edba96d934e627ad61d0298b9223cccd299d741
Author: Simon Howard <fraggle at gmail.com>
Date:   Wed Sep 14 21:55:47 2005 +0000

    Lock surfaces properly when we have to (fixes crash under Windows 98)
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 105
---
 NEWS          |  2 ++
 src/i_video.c | 23 +++++++++++------------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 35246b0..940aa52 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+    Lock surfaces properly when we have to (fixes crash under
+    Windows 98)
 
 0.0.2 (2005-09-13):
     Remove temporary MIDI files generated by sound code.
diff --git a/src/i_video.c b/src/i_video.c
index 155731b..f3b38d7 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 98 2005-09-11 20:25:56Z fraggle $
+// $Id: i_video.c 105 2005-09-14 21:55:47Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.26  2005/09/14 21:55:47  fraggle
+// Lock surfaces properly when we have to (fixes crash under Windows 98)
+//
 // Revision 1.25  2005/09/11 20:25:56  fraggle
 // Second configuration file to allow chocolate doom-specific settings.
 // Adjust some existing command line logic (for graphics settings and
@@ -115,7 +118,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 98 2005-09-11 20:25:56Z fraggle $";
+rcsid[] = "$Id: i_video.c 105 2005-09-14 21:55:47Z fraggle $";
 
 #include <ctype.h>
 #include <SDL.h>
@@ -618,9 +621,6 @@ void I_FinishUpdate (void)
         SDL_UnlockSurface(screen);
     }
 
-    if (native_surface)
-        SDL_UnlockSurface(screen);
-
     // draw to screen
     
     if (palette_to_set)
@@ -632,9 +632,6 @@ void I_FinishUpdate (void)
     {
         SDL_Flip(screen);
     }
-
-    if (native_surface)
-        SDL_LockSurface(screen);
 }
 
 
@@ -746,8 +743,13 @@ void I_InitGraphics(void)
     UpdateGrab();
 
     // Check if we have a native surface we can use
+    // If we have to lock the screen, draw to a buffer and copy
+    // Likewise if the screen pitch is not the same as the width
+    // If we have to multiply, drawing is done to a separate 320x200 buf
 
-    native_surface = screenmultiply == 1 && screen->pitch == SCREENWIDTH;
+    native_surface = !SDL_MUSTLOCK(screen) 
+                  && screenmultiply == 1 
+                  && screen->pitch == SCREENWIDTH;
 
     // If not, allocate a buffer and copy from that buffer to the 
     // screen when we do an update
@@ -757,9 +759,6 @@ void I_InitGraphics(void)
     else
 	screens[0] = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
 
-    if (native_surface)
-        SDL_LockSurface(screen);
-
     LoadDiskImage();
 
     SDL_EnableUNICODE(1);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list