Crash on Quit

Calling SDL_Quit() or any of its more system specific functions (SDL_VideoQuit() for example) seems to my computer. Everything works fine until I’m about to finish the program and call the function.

This only happens on my desktop computer, I’ve compiled and run some tests and they crash as well. On the other hand, my laptop have no problems at all.

I’m using latest build from the SVN repository (5431 at the time of writing this). This is one of the sample programs that used to work but now it crash.

Code:

#include <stdio.h>
#include <stdlib.h>
/* Ensure we are using opengl’s core profile only */
#define GL3_PROTOTYPES 1
#include <GL3/gl3.h>

#include <SDL/SDL.h>
#define PROGRAM_NAME “Tutorial1”

/* A simple function that prints a message, the error code returned by SDL,

  • and quits the application */
    void sdldie(char *msg) {
    printf("%s: %s\n", msg, SDL_GetError());
    SDL_Quit();
    exit(1);
    }

/* Our program’s entry point */
int main(int argc, char argv[]) {
SDL_WindowID mainwindow; /
Our window handle /
SDL_GLContext maincontext; /
Our opengl context handle */

if (SDL_Init(SDL_INIT_VIDEO) < 0) /* Initialize SDL's Video subsystem */
	sdldie("Unable to initialize SDL"); /* Or die on error */

/* Request an opengl 3.2 context.
 * SDL doesn't have the ability to choose which profile at this time of writing,
 * but it should default to the core profile */
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

/* Turn on double buffering with a 24bit Z buffer.
 * You may need to change this to 16 or 32 for your system */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

/* Create our window centered at 512x512 resolution */
mainwindow = SDL_CreateWindow(PROGRAM_NAME, SDL_WINDOWPOS_CENTERED,
		SDL_WINDOWPOS_CENTERED, 512, 512, SDL_WINDOW_OPENGL
				| SDL_WINDOW_SHOWN);
if (!mainwindow) /* Die if creation failed */
	sdldie("Unable to create window");

/* Create our opengl context and attach it to our window */
maincontext = SDL_GL_CreateContext(mainwindow);

/* This makes our buffer swap syncronized with the monitor's vertical refresh */
SDL_GL_SetSwapInterval(1);

/* Clear our buffer with a red background */
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear ( GL_COLOR_BUFFER_BIT);
/* Swap our back buffer to the front */
SDL_GL_SwapWindow(mainwindow);
/* Wait 2 seconds */
SDL_Delay(2000);

/* Same as above, but green */
glClearColor(0.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(mainwindow);
SDL_Delay(2000);

/* Same as above, but blue */
glClearColor(0.0, 0.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(mainwindow);
SDL_Delay(2000);

/* Delete our opengl context, destroy our window, and shutdown SDL */
SDL_GL_DeleteContext(maincontext);
SDL_DestroyWindow(mainwindow);
SDL_Quit();

return 0;

}
}

My desktop specs are the following:
CPU: Intel I7 920
Mother Board: Asus P6T Deluxe V2
Ram: 6 gb DDR3
Video Card: Radeon HD4870x2
S.O: Windows 7 Business

My laptop specs are the following:
Laptop: Asus G1S
Ram: 4 gb DDR2
Video Card: GeForce 8600M GT
S.O: Windows 7 RC1

If any other info is needed just ask for it. Hope anyone can help me resolve this issue.

You have removed ifs that check whether the window or context was created. Maybe your desktop machine has got problems with initializing it and in the end you delete not created context od window. I bet the context wasnt created. This can explain why laptop has no problems.