aboutsummaryrefslogtreecommitdiff
path: root/src/MenuCreator.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira@fluxbox.org>2015-01-21 21:16:19 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-01-21 21:16:19 (GMT)
commite2dbdeeb2eb1dd1e2ff97499e894a86d47d9e3db (patch)
treeb8c195be09bb46413025ed2a8f0c3cc7eadc8482 /src/MenuCreator.cc
parent145cf94ea67a7d58ccd0a90dae8cba8c38a3275a (diff)
downloadfluxbox-e2dbdeeb2eb1dd1e2ff97499e894a86d47d9e3db.zip
fluxbox-e2dbdeeb2eb1dd1e2ff97499e894a86d47d9e3db.tar.bz2
Fix segfault on shutdown
There was a problem deep within how the menus were connected and when and what gets deleted. It was clearly related to a menu which was kind of global. In order to better understand the code flow I eliminated the ExtraMenu code: it was used only to get the Remember-Menu into the Window-Menu. Instead of having a singleton of the Remember-Menu and fight against the shaky interconnections we just create a new one on demand and delete when the menu gets deleted. Looks like this fixes the problem. The menu code needs more love anyway. Closes #1118
Diffstat (limited to 'src/MenuCreator.cc')
-rw-r--r--src/MenuCreator.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index a90e234..7f7445f 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -56,6 +56,10 @@
56#include <iostream> 56#include <iostream>
57#include <algorithm> 57#include <algorithm>
58 58
59#ifdef REMEMBER
60#include "Remember.hh"
61#endif // REMEMBER
62
59using std::cerr; 63using std::cerr;
60using std::endl; 64using std::endl;
61using std::string; 65using std::string;
@@ -88,6 +92,8 @@ enum {
88 92
89 L_ALPHA, 93 L_ALPHA,
90 94
95 L_REMEMBER,
96
91 L_MENU_EXIT, 97 L_MENU_EXIT,
92 L_MENU_ICONS, 98 L_MENU_ICONS,
93}; 99};
@@ -112,6 +118,8 @@ const FbTk::FbString& _l(const FbTk::FbString& label, size_t type) {
112 118
113 _FB_XTEXT(Configmenu, Transparency, "Transparency", "Menu containing various transparency options"), 119 _FB_XTEXT(Configmenu, Transparency, "Transparency", "Menu containing various transparency options"),
114 120
121 _FB_XTEXT(Remember, MenuItemName, "Remember...", "Remember item in menu"),
122
115 _FB_XTEXT(Menu, Exit, "Exit", "Exit Command"), 123 _FB_XTEXT(Menu, Exit, "Exit", "Exit Command"),
116 _FB_XTEXT(Menu, Icons, "Icons", "Iconic windows menu title"), 124 _FB_XTEXT(Menu, Icons, "Icons", "Iconic windows menu title"),
117 }; 125 };
@@ -602,14 +610,13 @@ bool MenuCreator::createWindowMenuItem(const string &type,
602 } 610 }
603#endif // HAVE_XRENDER 611#endif // HAVE_XRENDER
604 } else if (type == "extramenus") { 612 } else if (type == "extramenus") {
613#ifdef REMEMBER
605 BScreen* s = Fluxbox::instance()->findScreen(screen); 614 BScreen* s = Fluxbox::instance()->findScreen(screen);
606 BScreen::ExtraMenus::iterator it = s->extraWindowMenus().begin(); 615 if (s == 0) {
607 BScreen::ExtraMenus::iterator it_end = s->extraWindowMenus().end(); 616 return false;
608 for (; it != it_end; ++it) {
609 it->second->disableTitle();
610 menu.insertSubmenu(it->first, it->second);
611 } 617 }
612 618 menu.insertSubmenu(_l("", L_REMEMBER), Remember::createMenu(*s));
619#endif
613 } else if (type == "sendto") { 620 } else if (type == "sendto") {
614 menu.insertSubmenu(_l(label, L_SENDTO), 621 menu.insertSubmenu(_l(label, L_SENDTO),
615 new SendToMenu(*Fluxbox::instance()->findScreen(screen))); 622 new SendToMenu(*Fluxbox::instance()->findScreen(screen)));
@@ -634,4 +641,3 @@ bool MenuCreator::createWindowMenuItem(const string &type,
634 return true; 641 return true;
635} 642}
636 643
637