Sign in to follow this  
Followers 0
SMT

[bug] uncareful using shared menus

3 posts in this topic

howto see bug:

open favorite users page - each user have context menu with 'grant slot' submenu

close favorite users page

open favorite users page again - submenu disappeared

explanation is easy - shared menu linked into frame's menu and when frame's menu

destroyed, shared menu is also destroyed

i'n not sure, but possibly same bug can be in other frames

quick solution is to unlink all submenus before deleting frame, but if menu

contains private (not shared) submenus this can cause resource leak

...

LRESULT UsersFrame::onClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) {

		if(!closed) {

				FavoriteManager::getInstance()->removeListener(this);

				SettingsManager::getInstance()->removeListener(this);

[b]				while (usersMenu.GetMenuItemCount()) usersMenu.RemoveMenu(0, MF_BYPOSITION);[/b]

				closed = true;

				WinUtil::setButtonPressed(IDC_FAVUSERS, false);

...

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0