Skip to content

Commit

Permalink
* Fix bug where an extraneous render command can cause a crash when
Browse files Browse the repository at this point in the history
  recording video
* Make S_CodecUtilClose NULL the snd_stream_t pointer
* Fix indentation in runtime SDL check code
  • Loading branch information
timangus committed Nov 18, 2007
1 parent 3f3c827 commit b62950c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
2 changes: 2 additions & 0 deletions code/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,8 @@ void CL_Disconnect( qboolean showMainMenu ) {

// Stop recording any video
if( CL_VideoRecording( ) ) {
// Finish rendering current frame
SCR_UpdateScreen( );
CL_CloseAVI( );
}
CL_UpdateGUID( NULL, 0 );
Expand Down
7 changes: 4 additions & 3 deletions code/client/snd_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
S_CodecUtilClose
=================
*/
void S_CodecUtilClose(snd_stream_t *stream)
void S_CodecUtilClose(snd_stream_t **stream)
{
FS_FCloseFile(stream->file);
Z_Free(stream);
FS_FCloseFile((*stream)->file);
Z_Free(*stream);
*stream = NULL;
}
2 changes: 1 addition & 1 deletion code/client/snd_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int S_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);

// Util functions (used by codecs)
snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec);
void S_CodecUtilClose(snd_stream_t *stream);
void S_CodecUtilClose(snd_stream_t **stream);

// WAV Codec
extern snd_codec_t wav_codec;
Expand Down
12 changes: 6 additions & 6 deletions code/client/snd_codec_ogg.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ snd_stream_t *S_OGG_CodecOpenStream(const char *filename)
vf = Z_Malloc(sizeof(OggVorbis_File));
if(!vf)
{
S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);

return NULL;
}
Expand All @@ -261,7 +261,7 @@ snd_stream_t *S_OGG_CodecOpenStream(const char *filename)
{
Z_Free(vf);

S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);

return NULL;
}
Expand All @@ -273,7 +273,7 @@ snd_stream_t *S_OGG_CodecOpenStream(const char *filename)

Z_Free(vf);

S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);

return NULL;
}
Expand All @@ -285,7 +285,7 @@ snd_stream_t *S_OGG_CodecOpenStream(const char *filename)

Z_Free(vf);

S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);

return NULL;
}
Expand All @@ -298,7 +298,7 @@ snd_stream_t *S_OGG_CodecOpenStream(const char *filename)

Z_Free(vf);

S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);

return NULL;
}
Expand Down Expand Up @@ -343,7 +343,7 @@ void S_OGG_CodecCloseStream(snd_stream_t *stream)
Z_Free(stream->ptr);

// close the stream
S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions code/client/snd_codec_wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ snd_stream_t *S_WAV_CodecOpenStream(const char *filename)
// Read the RIFF header
if(!S_ReadRIFFHeader(rv->file, &rv->info))
{
S_CodecUtilClose(rv);
S_CodecUtilClose(&rv);
return NULL;
}

Expand All @@ -269,7 +269,7 @@ S_WAV_CodecCloseStream
*/
void S_WAV_CodecCloseStream(snd_stream_t *stream)
{
S_CodecUtilClose(stream);
S_CodecUtilClose(&stream);
}

/*
Expand Down
22 changes: 11 additions & 11 deletions code/sys/sys_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,21 +587,21 @@ int main( int argc, char **argv )
char commandLine[ MAX_STRING_CHARS ] = { 0 };

#ifndef DEDICATED
const SDL_version *ver = SDL_Linked_Version( );
const SDL_version *ver = SDL_Linked_Version( );

#define STRING(s) #s
#define XSTRING(s) STRING(s)
#define MINSDL_VERSION \
XSTRING(MINSDL_MAJOR) "." \
XSTRING(MINSDL_MINOR) "." \
XSTRING(MINSDL_PATCH)

if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) <
SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) )
{
Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" );
Sys_Exit( 1 );
}
XSTRING(MINSDL_MAJOR) "." \
XSTRING(MINSDL_MINOR) "." \
XSTRING(MINSDL_PATCH)

if( SDL_VERSIONNUM( ver->major, ver->minor, ver->patch ) <
SDL_VERSIONNUM( MINSDL_MAJOR, MINSDL_MINOR, MINSDL_PATCH ) )
{
Sys_Print( "SDL version " MINSDL_VERSION " or greater required\n" );
Sys_Exit( 1 );
}
#endif

Sys_ParseArgs( argc, argv );
Expand Down

0 comments on commit b62950c

Please sign in to comment.