mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 14:26:01 +00:00
Initialize invalid parent_{tray,entry} to NULL
The API states that the related functions must return NULL if the function called (get the parent tray, or get the parent entry) is invalid for this menu. Initialising the fields to NULL makes that API correct for Windows.
This commit is contained in:
@@ -304,6 +304,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
|
||||
|
||||
tray->menu->hMenu = CreatePopupMenu();
|
||||
tray->menu->parent_tray = tray;
|
||||
tray->menu->parent_entry = NULL;
|
||||
|
||||
return tray->menu;
|
||||
}
|
||||
@@ -395,6 +396,8 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_memset((void *) entry, 0, sizeof(*entry));
|
||||
|
||||
wchar_t *label_w = NULL;
|
||||
|
||||
if (label && (label_w = escape_label(label)) == NULL) {
|
||||
@@ -417,10 +420,13 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_memset((void *) entry->submenu, 0, sizeof(*entry->submenu));
|
||||
|
||||
entry->submenu->hMenu = CreatePopupMenu();
|
||||
entry->submenu->nEntries = 0;
|
||||
entry->submenu->entries = NULL;
|
||||
entry->submenu->parent_entry = entry;
|
||||
entry->submenu->parent_tray = NULL;
|
||||
|
||||
entry->id = (UINT_PTR) entry->submenu->hMenu;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user