aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-09-05 01:11:41 (GMT)
committerfluxgen <fluxgen>2004-09-05 01:11:41 (GMT)
commit23fcec1728ab197251da548fe0ebeea9177d0902 (patch)
treea8985880e31ae04e7ca423ea5321e3de8b355628
parentfb2e570e8c9fe92e448b017643c202c49a5d2457 (diff)
downloadfluxbox_paul-23fcec1728ab197251da548fe0ebeea9177d0902.zip
fluxbox_paul-23fcec1728ab197251da548fe0ebeea9177d0902.tar.bz2
fix for crash on shutdown, the workspacemenu must be destroyed before clientlist. fix for duplicates in iconlist, note: check update(stateSig) in fluxbox.cc, icons might be added twice
-rw-r--r--src/Screen.cc41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index e947de7..8d3e2ee 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.286 2004/08/30 11:33:23 akir Exp $ 25// $Id: Screen.cc,v 1.287 2004/09/05 01:11:41 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -407,8 +407,12 @@ void destroyAndClearList(A &a) {
407} 407}
408 408
409BScreen::~BScreen() { 409BScreen::~BScreen() {
410
410 if (! managed) 411 if (! managed)
411 return; 412 return;
413 // Since workspacemenu holds client list menus (from workspace)
414 // we need to destroy it before we destroy workspaces
415 m_workspacemenu.reset(0);
412 416
413 if (m_rootmenu.get() != 0) 417 if (m_rootmenu.get() != 0)
414 m_rootmenu->removeAll(); 418 m_rootmenu->removeAll();
@@ -651,7 +655,7 @@ void BScreen::hideWindowMenus(const FluxboxWindow* except) {
651 const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end(); 655 const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end();
652 for (; win_it != win_it_end; ++win_it) { 656 for (; win_it != win_it_end; ++win_it) {
653 if (*win_it != except) 657 if (*win_it != except)
654 (*win_it)->menu().hide(); 658 (*win_it)->menu().hide();
655 } 659 }
656 } 660 }
657 } 661 }
@@ -772,7 +776,12 @@ void BScreen::addIcon(FluxboxWindow *w) {
772 if (w == 0) 776 if (w == 0)
773 return; 777 return;
774 778
779 // make sure we have a unique list
780 if (find(getIconList().begin(), getIconList().end(), w) != getIconList().end())
781 return;
782
775 m_icon_list.push_back(w); 783 m_icon_list.push_back(w);
784
776 // notify listeners 785 // notify listeners
777 m_iconlist_sig.notify(); 786 m_iconlist_sig.notify();
778} 787}
@@ -782,20 +791,28 @@ void BScreen::removeIcon(FluxboxWindow *w) {
782 if (w == 0) 791 if (w == 0)
783 return; 792 return;
784 793
785 Icons::iterator erase_it = remove_if(m_icon_list.begin(), 794 Icons::iterator erase_it = remove_if(getIconList().begin(),
786 m_icon_list.end(), 795 getIconList().end(),
787 bind2nd(equal_to<FluxboxWindow *>(), w)); 796 bind2nd(equal_to<FluxboxWindow *>(), w));
788 if (erase_it != m_icon_list.end()) 797 // no need to send iconlist signal if we didn't
789 m_icon_list.erase(erase_it); 798 // change the iconlist
790 799 if (erase_it != m_icon_list.end()) {
791 m_iconlist_sig.notify(); 800 getIconList().erase(erase_it);
801 m_iconlist_sig.notify();
802 }
792} 803}
793 804
794void BScreen::removeWindow(FluxboxWindow *win) { 805void BScreen::removeWindow(FluxboxWindow *win) {
795 if (win->isIconic()) 806#ifdef DEBUG
796 removeIcon(win); 807 cerr<<"BScreen::removeWindow("<<win<<")"<<endl;
797 else 808#endif // DEBUG
798 getWorkspace(win->workspaceNumber())->removeWindow(win, false); 809 // extra precaution, if for some reason, the
810 // icon list should be out of sync
811 removeIcon(win);
812 // remove from workspace
813 Workspace *space = getWorkspace(win->workspaceNumber());
814 if (space != 0)
815 space->removeWindow(win, false);
799} 816}
800 817
801 818