Skip to content

Commit 1cb8afc

Browse files
author
Semphris
committed
Initialize invalid parent_{menu,entry} to NULL
1 parent ea0c655 commit 1cb8afc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/tray/windows/SDL_tray.c

+6
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
304304

305305
tray->menu->hMenu = CreatePopupMenu();
306306
tray->menu->parent_tray = tray;
307+
tray->menu->parent_entry = NULL;
307308

308309
return tray->menu;
309310
}
@@ -395,6 +396,8 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la
395396
return NULL;
396397
}
397398

399+
SDL_memset((void *) entry, 0, sizeof(*entry));
400+
398401
wchar_t *label_w = NULL;
399402

400403
if (label && (label_w = escape_label(label)) == NULL) {
@@ -417,10 +420,13 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la
417420
return NULL;
418421
}
419422

423+
SDL_memset((void *) entry->submenu, 0, sizeof(*entry->submenu));
424+
420425
entry->submenu->hMenu = CreatePopupMenu();
421426
entry->submenu->nEntries = 0;
422427
entry->submenu->entries = NULL;
423428
entry->submenu->parent_entry = entry;
429+
entry->submenu->parent_tray = entry;
424430

425431
entry->id = (UINT_PTR) entry->submenu->hMenu;
426432
} else {

0 commit comments

Comments
 (0)