mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-05 19:45:38 +00:00
video: fix error messages
- do not overwrite error message set by SDL_InitFormat (SDL_AllocFormat) - set proper error message (Cocoa_Metal_CreateView) - protect against allocation failure (UIKit_Metal_CreateView) (cherry picked from commit cf0cb44df88a4293805fdc926880155d58a46bea)
This commit is contained in:
parent
84039e2514
commit
724845110c
|
@ -530,7 +530,6 @@ SDL_AllocFormat(Uint32 pixel_format)
|
||||||
if (SDL_InitFormat(format, pixel_format) < 0) {
|
if (SDL_InitFormat(format, pixel_format) < 0) {
|
||||||
SDL_AtomicUnlock(&formats_lock);
|
SDL_AtomicUnlock(&formats_lock);
|
||||||
SDL_free(format);
|
SDL_free(format);
|
||||||
SDL_InvalidParamError("format");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,6 +670,7 @@ SDL_AllocPalette(int ncolors)
|
||||||
(SDL_Color *) SDL_malloc(ncolors * sizeof(*palette->colors));
|
(SDL_Color *) SDL_malloc(ncolors * sizeof(*palette->colors));
|
||||||
if (!palette->colors) {
|
if (!palette->colors) {
|
||||||
SDL_free(palette);
|
SDL_free(palette);
|
||||||
|
SDL_OutOfMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
palette->ncolors = ncolors;
|
palette->ncolors = ncolors;
|
||||||
|
|
|
@ -144,6 +144,7 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window * window)
|
||||||
highDPI:highDPI
|
highDPI:highDPI
|
||||||
windowID:windowID];
|
windowID:windowID];
|
||||||
if (newview == nil) {
|
if (newview == nil) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,11 @@ UIKit_Metal_CreateView(_THIS, SDL_Window * window)
|
||||||
|
|
||||||
metalview = [[SDL_uikitmetalview alloc] initWithFrame:data.uiwindow.bounds
|
metalview = [[SDL_uikitmetalview alloc] initWithFrame:data.uiwindow.bounds
|
||||||
scale:scale];
|
scale:scale];
|
||||||
|
if (metalview == nil) {
|
||||||
|
SDL_OutOfMemory();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
[metalview setSDLWindow:window];
|
[metalview setSDLWindow:window];
|
||||||
|
|
||||||
return (void*)CFBridgingRetain(metalview);
|
return (void*)CFBridgingRetain(metalview);
|
||||||
|
|
Loading…
Reference in a new issue