mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
Fix context menu bug
This commit is contained in:
@@ -357,8 +357,8 @@ void showContextMenu(struct Application *app, const char *contextMenuID) {
|
||||
id contextMenu = (id)hashmap_get(&contextMenuMap, (char*)contextMenuID, strlen(contextMenuID));
|
||||
|
||||
if( contextMenu == NULL ) {
|
||||
printf("No context menu called '%s'. Available:", contextMenuID);
|
||||
dumpHashmap("contextMenuMap", &contextMenuMap);
|
||||
// printf("No context menu called '%s'. Available:", contextMenuID);
|
||||
// dumpHashmap("contextMenuMap", &contextMenuMap);
|
||||
|
||||
// Free menu id
|
||||
MEMFREE(contextMenuID);
|
||||
@@ -920,11 +920,6 @@ void destroyMenu(struct Application *app) {
|
||||
|
||||
void destroyContextMenus(struct Application *app) {
|
||||
|
||||
// If we don't have a context menu, return
|
||||
if( app->contextMenusAsJSON == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Free menu item hashmap
|
||||
hashmap_destroy(&menuItemMapForContextMenus);
|
||||
|
||||
@@ -2405,9 +2400,6 @@ void dumpContextMenus(struct Application *app) {
|
||||
|
||||
void parseContextMenus(struct Application *app) {
|
||||
|
||||
// Allocation the hashmaps we need
|
||||
allocateContextMenuHashMaps(app);
|
||||
|
||||
// Parse the context menu json
|
||||
app->processedContextMenus = json_decode(app->contextMenusAsJSON);
|
||||
|
||||
@@ -2800,6 +2792,9 @@ void Run(struct Application *app, int argc, char **argv) {
|
||||
parseTrayData(app);
|
||||
}
|
||||
|
||||
// Allocation the hashmaps we need
|
||||
allocateContextMenuHashMaps(app);
|
||||
|
||||
// If we have context menus, process them
|
||||
if( app->contextMenusAsJSON != NULL ) {
|
||||
parseContextMenus(app);
|
||||
|
||||
Reference in New Issue
Block a user