Delay guarantee of cleanup until initialization is complete
Solves most of Bug 683. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1599 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Changes towards version 0.4:
|
||||
- Fixed segfault when shutting down because video could not be initialized
|
||||
(bug #683), - Michael
|
||||
- Fixed crash when restarting Sa-Matra battle after abort (bug #700) -Alex
|
||||
- Some cleanups, enabling successful build with GCC 4 (bug #710),
|
||||
mostly from Ville Skyttà - SvdB
|
||||
|
||||
@@ -101,6 +101,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
videomode_flags = SDL_OPENGL;
|
||||
if (flags & TFB_GFXFLAGS_FULLSCREEN)
|
||||
videomode_flags |= SDL_FULLSCREEN;
|
||||
videomode_flags |= SDL_ANYFORMAT;
|
||||
|
||||
SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual,
|
||||
bpp, videomode_flags);
|
||||
@@ -109,7 +110,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
fprintf (stderr, "Couldn't set OpenGL %ix%ix%i video mode: %s\n",
|
||||
ScreenWidthActual, ScreenHeightActual, bpp,
|
||||
SDL_GetError ());
|
||||
exit (-1);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +136,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
if (scaled_display == NULL)
|
||||
{
|
||||
fprintf (stderr, "Couldn't create scaled_display: %s\n", SDL_GetError());
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
if (scaled_transition)
|
||||
{
|
||||
@@ -147,7 +148,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
if (scaled_transition == NULL)
|
||||
{
|
||||
fprintf (stderr, "Couldn't create scaled_transition: %s\n", SDL_GetError());
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
texture_width = 1024;
|
||||
@@ -169,7 +170,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
if (format_conv_surf == NULL)
|
||||
{
|
||||
fprintf (stderr, "Couldn't create format_conv_surf: %s\n", SDL_GetError());
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (GfxFlags & TFB_GFXFLAGS_SCALE_BILINEAR ||
|
||||
@@ -234,7 +235,11 @@ TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
ScreenWidth = 320;
|
||||
ScreenHeight = 240;
|
||||
|
||||
TFB_GL_ConfigureVideo (driver, flags, width, height, bpp);
|
||||
if (TFB_GL_ConfigureVideo (driver, flags, width, height, bpp))
|
||||
{
|
||||
fprintf (stderr, "Could not initialize video: no fallback at start of program!\n");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
// pre-compute the RGB->YUV transformations
|
||||
Scale_PrepYUV();
|
||||
|
||||
@@ -74,7 +74,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
fprintf (stderr, "Couldn't set %ix%ix%i video mode: %s\n",
|
||||
ScreenWidthActual, ScreenHeightActual, bpp,
|
||||
SDL_GetError ());
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -89,7 +89,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
if (test_extra == NULL)
|
||||
{
|
||||
fprintf (stderr, "Couldn't create back buffer: %s\n", SDL_GetError());
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
|
||||
@@ -127,7 +127,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int bpp)
|
||||
{
|
||||
fprintf (stderr, "Fatal error: SDL_Video and SDL_Screen bpp doesn't match (%d vs. %d)\n",
|
||||
SDL_Video->format->BytesPerPixel,SDL_Screen->format->BytesPerPixel);
|
||||
exit(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -154,7 +154,11 @@ TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
ScreenWidth = 320;
|
||||
ScreenHeight = 240;
|
||||
|
||||
TFB_Pure_ConfigureVideo (driver, flags, width, height, bpp);
|
||||
if (TFB_Pure_ConfigureVideo (driver, flags, width, height, bpp))
|
||||
{
|
||||
fprintf (stderr, "Could not initialize video: no fallback at start of program!\n");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
// pre-compute the RGB->YUV transformations
|
||||
Scale_PrepYUV();
|
||||
|
||||
@@ -121,8 +121,6 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
atexit (TFB_UninitGraphics);
|
||||
|
||||
GfxFlags = flags;
|
||||
|
||||
if (driver == TFB_GFXDRIVER_SDL_OPENGL)
|
||||
@@ -156,6 +154,8 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||
RenderingCond = CreateCondVar ("DCQ empty",
|
||||
SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
|
||||
|
||||
atexit (TFB_UninitGraphics);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user