aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/FbTk/Menu.cc10
-rw-r--r--src/MenuCreator.cc1
-rw-r--r--src/Screen.cc5
-rw-r--r--src/Slit.cc3
-rw-r--r--src/Toolbar.cc3
-rw-r--r--src/fluxbox.cc13
7 files changed, 26 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eac1dc..97023c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.16: 2Changes for 0.9.16:
3*06/04/24: 3*06/04/24:
4 * Fix memory leaks & other errors in Menu code (Simon)
5 Screen.cc Slit.cc Toolbar.cc fluxbox.cc MenuCreator.cc FbTk/Menu.cc
4 * Use external tabs by default (Simon) 6 * Use external tabs by default (Simon)
5 - they provide a unique look to fluxbox 7 - they provide a unique look to fluxbox
6 - backwards compatible with 0.1.14 ("stable") 8 - backwards compatible with 0.1.14 ("stable")
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 4775ae9..b08bfe9 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -232,14 +232,16 @@ int Menu::remove(unsigned int index) {
232 if (item) { 232 if (item) {
233 menuitems.erase(it); 233 menuitems.erase(it);
234 234
235 if (!m_internal_menu && item->submenu() != 0) { 235 if (item->submenu() != 0) {
236 Menu *tmp = item->submenu(); 236 Menu *tmp = item->submenu();
237 // if menu is interal we should just hide it instead 237 // if menu is internal we should just hide it instead
238 // if destroying it 238 // if destroying it
239 if (! tmp->m_internal_menu) { 239 if (! tmp->m_internal_menu) {
240 delete tmp; 240 delete tmp;
241 } else 241 }
242 tmp->internal_hide(); 242 // We can't internal_hide here, as the child may be deleted!
243// } else
244// tmp->internal_hide();
243 } 245 }
244 246
245 247
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 4a2cc0e..c97d51d 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -454,7 +454,6 @@ FbTk::Menu *MenuCreator::createMenuType(const std::string &type, int screen_num)
454 } else if (type == "windowmenu") { 454 } else if (type == "windowmenu") {
455 FbTk::Menu *menu = screen->createMenu(""); 455 FbTk::Menu *menu = screen->createMenu("");
456 456
457 menu->removeAll(); // clear old items
458 menu->disableTitle(); // not titlebar 457 menu->disableTitle(); // not titlebar
459 if (screen->windowMenuFilename().empty() || 458 if (screen->windowMenuFilename().empty() ||
460 ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) { 459 ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) {
diff --git a/src/Screen.cc b/src/Screen.cc
index a41fb0f..03ec510 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -728,6 +728,7 @@ void BScreen::addExtraWindowMenu(const char *label, FbTk::Menu *menu) {
728 m_extramenus.push_back(std::make_pair(label, menu)); 728 m_extramenus.push_back(std::make_pair(label, menu));
729 // recreate window menu 729 // recreate window menu
730 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); 730 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
731 m_windowmenu->setInternalMenu();
731} 732}
732 733
733void BScreen::removeExtraWindowMenu(FbTk::Menu *menu) { 734void BScreen::removeExtraWindowMenu(FbTk::Menu *menu) {
@@ -739,6 +740,7 @@ void BScreen::removeExtraWindowMenu(FbTk::Menu *menu) {
739 m_extramenus.erase(it); 740 m_extramenus.erase(it);
740 // recreate window menu 741 // recreate window menu
741 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); 742 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
743 m_windowmenu->setInternalMenu();
742} 744}
743 745
744void BScreen::hideMenus() { 746void BScreen::hideMenus() {
@@ -827,6 +829,7 @@ void BScreen::reconfigure() {
827 m_configmenu->reconfigure(); 829 m_configmenu->reconfigure();
828 // recreate window menu 830 // recreate window menu
829 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); 831 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
832 m_windowmenu->setInternalMenu();
830 833
831 // We need to check to see if the timestamps 834 // We need to check to see if the timestamps
832 // changed before we actually can restore the menus 835 // changed before we actually can restore the menus
@@ -1501,6 +1504,7 @@ void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
1501void BScreen::initMenus() { 1504void BScreen::initMenus() {
1502 m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber())); 1505 m_workspacemenu.reset(MenuCreator::createMenuType("workspacemenu", screenNumber()));
1503 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber())); 1506 m_windowmenu.reset(MenuCreator::createMenuType("windowmenu", screenNumber()));
1507 m_windowmenu->setInternalMenu();
1504 initMenu(); 1508 initMenu();
1505} 1509}
1506 1510
@@ -1554,6 +1558,7 @@ void BScreen::removeConfigMenu(FbTk::Menu &menu) {
1554 FbTk::Select2nd<Configmenus::value_type>())); 1558 FbTk::Select2nd<Configmenus::value_type>()));
1555 if (erase_it != m_configmenu_list.end()) 1559 if (erase_it != m_configmenu_list.end())
1556 m_configmenu_list.erase(erase_it); 1560 m_configmenu_list.erase(erase_it);
1561
1557 setupConfigmenu(*m_configmenu.get()); 1562 setupConfigmenu(*m_configmenu.get());
1558 1563
1559} 1564}
diff --git a/src/Slit.cc b/src/Slit.cc
index af3a0be..db2deae 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -347,6 +347,9 @@ Slit::~Slit() {
347 if (frame.pixmap != 0) 347 if (frame.pixmap != 0)
348 screen().imageControl().removeImage(frame.pixmap); 348 screen().imageControl().removeImage(frame.pixmap);
349 349
350 // otherwise it will try to access it on deletion
351 screen().removeConfigMenu(m_slitmenu);
352
350 shutdown(); 353 shutdown();
351} 354}
352 355
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 6384430..a863b3f 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -252,6 +252,7 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
252 252
253 m_layermenu.setInternalMenu(); 253 m_layermenu.setInternalMenu();
254 m_placementmenu.setInternalMenu(); 254 m_placementmenu.setInternalMenu();
255 m_toolbarmenu.setInternalMenu();
255 setupMenus(); 256 setupMenus();
256 // add menu to screen 257 // add menu to screen
257 screen().addConfigMenu(_FBTEXT(Toolbar, Toolbar, "Toolbar", "title of toolbar menu item"), menu()); 258 screen().addConfigMenu(_FBTEXT(Toolbar, Toolbar, "Toolbar", "title of toolbar menu item"), menu());
@@ -287,6 +288,8 @@ Toolbar::~Toolbar() {
287 // remove menu items before we delete tools so we dont end up 288 // remove menu items before we delete tools so we dont end up
288 // with dangling pointers to old submenu items (internal menus) 289 // with dangling pointers to old submenu items (internal menus)
289 // from the tools 290 // from the tools
291 screen().removeConfigMenu(menu());
292
290 menu().removeAll(); 293 menu().removeAll();
291 294
292 deleteItems(); 295 deleteItems();
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index f5066b7..c18cc32 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -418,12 +418,6 @@ Fluxbox::~Fluxbox() {
418 delete m_toolbars.back(); 418 delete m_toolbars.back();
419 m_toolbars.pop_back(); 419 m_toolbars.pop_back();
420 } 420 }
421
422 // destroy screens
423 while (!m_screen_list.empty()) {
424 delete m_screen_list.back();
425 m_screen_list.pop_back();
426 }
427 421
428 // destroy atomhandlers 422 // destroy atomhandlers
429 for (AtomHandlerContainerIt it= m_atomhandler.begin(); 423 for (AtomHandlerContainerIt it= m_atomhandler.begin();
@@ -433,6 +427,13 @@ Fluxbox::~Fluxbox() {
433 } 427 }
434 m_atomhandler.clear(); 428 m_atomhandler.clear();
435 429
430 // destroy screens (after others, as they may do screen things)
431 while (!m_screen_list.empty()) {
432 delete m_screen_list.back();
433 m_screen_list.pop_back();
434 }
435
436
436 clearMenuFilenames(); 437 clearMenuFilenames();
437} 438}
438 439