Started Windows menu destruction code and fixed a bug in GTK+ menu destruction.

This commit is contained in:
Pietro Gagliardi 2015-04-30 16:44:06 -04:00
parent 14de9f3cad
commit b52aa4cfcb
2 changed files with 6 additions and 5 deletions

View File

@ -48,8 +48,9 @@ static void windowDestroy(uiControl *c)
// now destroy the bin
// the bin has no parent, so we can just call uiControlDestroy()
uiControlDestroy(uiControl(w->bin));
// now destroy the menus
freeMenubar(w->menubar);
// now destroy the menus, if any
if (w->menubar != NULL)
freeMenubar(w->menubar);
// now destroy ourselves
// this will also free the vbox
gtk_widget_destroy(w->widget);

View File

@ -6,6 +6,7 @@
struct window {
uiWindow w;
HWND hwnd;
HMENU menubar;
uiContainer *bin;
int hidden;
BOOL shownOnce;
@ -226,7 +227,6 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
RECT adjust;
WCHAR *wtitle;
BOOL hasMenubarBOOL;
HMENU hmenu;
w = uiNew(struct window);
@ -260,8 +260,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
binSetParent(w->bin, (uintptr_t) (w->hwnd));
if (hasMenubar) {
hmenu = makeMenubar();
if (SetMenu(w->hwnd, hmenu) == 0)
w->menubar = makeMenubar();
if (SetMenu(w->hwnd, w->menubar) == 0)
logLastError("error giving menu to window in uiNewWindow()");
}