mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 14:43:20 +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:
parent
b79ada6aa5
commit
354d2c390c
1 changed files with 6 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue