aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Remember.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 8a5b29e..8e133b8 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -593,6 +593,7 @@ void Remember::reconfigure() {
593 593
594 // we merge the old patterns with new ones 594 // we merge the old patterns with new ones
595 Patterns *old_pats = m_pats.release(); 595 Patterns *old_pats = m_pats.release();
596 set<Application *> reused_apps;
596 m_pats.reset(new Patterns()); 597 m_pats.reset(new Patterns());
597 m_startups.clear(); 598 m_startups.clear();
598 599
@@ -621,9 +622,10 @@ void Remember::reconfigure() {
621 if (!in_group) { 622 if (!in_group) {
622 if ((err = pat->error()) == 0) { 623 if ((err = pat->error()) == 0) {
623 Application *app = findMatchingPatterns(pat, old_pats, false); 624 Application *app = findMatchingPatterns(pat, old_pats, false);
624 if (app) 625 if (app) {
625 app->reset(); 626 app->reset();
626 else 627 reused_apps.insert(app);
628 } else
627 app = new Application(false); 629 app = new Application(false);
628 630
629 m_pats->push_back(make_pair(pat, app)); 631 m_pats->push_back(make_pair(pat, app));
@@ -659,6 +661,8 @@ void Remember::reconfigure() {
659 661
660 if (!app) 662 if (!app)
661 app = new Application(in_group, pat); 663 app = new Application(in_group, pat);
664 else
665 reused_apps.insert(app);
662 666
663 while (!grouped_pats.empty()) { 667 while (!grouped_pats.empty()) {
664 // associate all the patterns with this app 668 // associate all the patterns with this app
@@ -695,7 +699,8 @@ void Remember::reconfigure() {
695 while (!old_pats->empty()) { 699 while (!old_pats->empty()) {
696 it = old_pats->begin(); 700 it = old_pats->begin();
697 delete it->first; // ClientPattern 701 delete it->first; // ClientPattern
698 old_apps.insert(it->second); // Application, not necessarily unique 702 if (reused_apps.find(it->second) == reused_apps.end())
703 old_apps.insert(it->second); // Application, not necessarily unique
699 old_pats->erase(it); 704 old_pats->erase(it);
700 } 705 }
701 706