mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 22:35:59 +00:00
tray: document thread-safety
This commit is contained in:
@@ -80,6 +80,11 @@ static void DestroySDLMenu(SDL_TrayMenu *menu)
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
icon = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_RGBA32);
|
||||
if (!icon) {
|
||||
|
@@ -398,6 +398,11 @@ static void DestroySDLMenu(SDL_TrayMenu *menu)
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (init_gtk() != true) {
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -211,6 +211,11 @@ static HICON load_default_icon()
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_Tray *tray = (SDL_Tray *)SDL_calloc(1, sizeof(*tray));
|
||||
|
||||
if (!tray) {
|
||||
|
Reference in New Issue
Block a user