mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-29 16:09:13 +00:00
Ensure that all functions that follow the SDL_GetStringRule return temporary memory
This commit is contained in:
parent
fd9fe1bb7b
commit
68322ac851
12 changed files with 15 additions and 36 deletions
|
@ -2452,7 +2452,6 @@ void SDL_SendAndroidBackButton(void)
|
|||
(*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton);
|
||||
}
|
||||
|
||||
// this caches a string until the process ends, so there's no need to use SDL_FreeLater.
|
||||
const char *SDL_GetAndroidInternalStoragePath(void)
|
||||
{
|
||||
static char *s_AndroidInternalFilesPath = NULL;
|
||||
|
@ -2504,7 +2503,7 @@ const char *SDL_GetAndroidInternalStoragePath(void)
|
|||
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
}
|
||||
return s_AndroidInternalFilesPath;
|
||||
return SDL_CreateTemporaryString(s_AndroidInternalFilesPath);
|
||||
}
|
||||
|
||||
Uint32 SDL_GetAndroidExternalStorageState(void)
|
||||
|
@ -2547,7 +2546,6 @@ Uint32 SDL_GetAndroidExternalStorageState(void)
|
|||
return stateFlags;
|
||||
}
|
||||
|
||||
// this caches a string until the process ends, so there's no need to use SDL_FreeLater.
|
||||
const char *SDL_GetAndroidExternalStoragePath(void)
|
||||
{
|
||||
static char *s_AndroidExternalFilesPath = NULL;
|
||||
|
@ -2590,10 +2588,9 @@ const char *SDL_GetAndroidExternalStoragePath(void)
|
|||
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
}
|
||||
return s_AndroidExternalFilesPath;
|
||||
return SDL_CreateTemporaryString(s_AndroidExternalFilesPath);
|
||||
}
|
||||
|
||||
// this caches a string until the process ends, so there's no need to use SDL_FreeLater.
|
||||
const char *SDL_GetAndroidCachePath(void)
|
||||
{
|
||||
// !!! FIXME: lots of duplication with SDL_GetAndroidExternalStoragePath and SDL_GetAndroidInternalStoragePath; consolidate these functions!
|
||||
|
@ -2637,7 +2634,7 @@ const char *SDL_GetAndroidCachePath(void)
|
|||
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
}
|
||||
return s_AndroidCachePath;
|
||||
return SDL_CreateTemporaryString(s_AndroidCachePath);
|
||||
}
|
||||
|
||||
int SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue