mirror of
https://github.com/yawut/SDL.git
synced 2026-08-25 18:25:16 -05:00
Fixed seg fault on video quit
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This wrapper is here so that the driverdata can be freed */
|
||||
typedef struct SDL_DisplayModeData {
|
||||
display_mode *bmode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static inline SDL_BWin *_ToBeWin(SDL_Window *window) {
|
||||
return ((SDL_BWin*)(window->driverdata));
|
||||
}
|
||||
@@ -107,8 +114,9 @@ static inline void BE_BDisplayModeToSdlDisplayMode(display_mode *bmode,
|
||||
mode->w = bmode->virtual_width;
|
||||
mode->h = bmode->virtual_height;
|
||||
mode->refresh_rate = (int)get_refresh_rate(*bmode);
|
||||
mode->driverdata = bmode; /* This makes setting display
|
||||
modes easier */
|
||||
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, sizeof(SDL_DisplayModeData));
|
||||
data->bmode = bmode;
|
||||
mode->driverdata = data;
|
||||
|
||||
/* Set the format */
|
||||
int32 bpp = ColorSpaceToBitsPerPixel(bmode->space);
|
||||
@@ -191,7 +199,7 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
|
||||
BScreen bscreen;
|
||||
|
||||
/* Set the mode using the driver data */
|
||||
display_mode *bmode = (display_mode*)mode->driverdata;
|
||||
display_mode *bmode = ((SDL_DisplayModeData*)mode->driverdata)->bmode;
|
||||
if(bscreen.SetMode(bmode) == B_OK) {
|
||||
return 0; /* No error */
|
||||
}
|
||||
|
||||
@@ -59,10 +59,11 @@ static SDL_VideoDevice *
|
||||
BE_CreateDevice(int devindex)
|
||||
{
|
||||
SDL_VideoDevice *device;
|
||||
SDL_VideoData *data;
|
||||
/*SDL_VideoData *data;*/
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
#if 0
|
||||
if (device) {
|
||||
data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
|
||||
} else {
|
||||
@@ -75,7 +76,8 @@ BE_CreateDevice(int devindex)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
device->driverdata = data;
|
||||
#endif
|
||||
device->driverdata = NULL; /*data;*/
|
||||
|
||||
/* TODO: Figure out what sort of initialization needs to go here */
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ extern "C" {
|
||||
#include "../../main/beos/SDL_BeApp.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
typedef struct SDL_VideoData {
|
||||
|
||||
} SDL_VideoData;
|
||||
|
||||
extern void BE_VideoQuit(_THIS);
|
||||
extern int BE_VideoInit(_THIS);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
|
||||
extern int BE_CreateWindow(_THIS, SDL_Window *window);
|
||||
extern int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
|
||||
extern void BE_SetWindowTitle(_THIS, SDL_Window * window);
|
||||
|
||||
Reference in New Issue
Block a user