Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2010, 7:50:06 PM (14 years ago)
Author:
dafrick
Message:

Done some selective testing and it finally seems to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/src/modules/notifications/NotificationManager.cc

    r7395 r7398  
    165165            this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
    166166
    167         COUT(4) << "Notification (&" << notification << ")unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
     167        COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
    168168    }
    169169
     
    212212        // If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.
    213213        bool bAll = set.find(NotificationManager::ALL) != set.end();
    214         std::multimap<std::time_t, Notification*> map;
     214        std::multimap<std::time_t, Notification*>* map;
    215215        if(bAll)
    216216            this->notificationLists_[index] = &this->allNotificationsList_;
     
    218218        {
    219219            this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>;
    220             map = *this->notificationLists_[index];
     220            map = this->notificationLists_[index];
    221221        }
    222222
     
    227227            {
    228228                if(!bAll)
    229                     map.insert(std::pair<std::time_t, Notification*>(it->first, it->second));
     229                    map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
    230230                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
    231231                if(counterIt == this->listenerCounter_.end())
     
    254254        std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
    255255
    256         // Make sure all Notifications are removed.
     256        // If the map is not the map of all notifications, make sure all Notifications are removed and delete it.
    257257        std::multimap<std::time_t, Notification*>::iterator it = map->begin();
    258         while(it != map->end())
    259         {
    260             this->unregisterNotification(it->second, listener);
    261             it = map->begin();
     258        if(map != &this->allNotificationsList_)
     259        {
     260            while(it != map->end())
     261            {
     262                this->unregisterNotification(it->second, listener);
     263                it = map->begin();
     264            }
     265            delete map;
    262266        }
    263267
    264268        this->listenerList_.erase(listener);
    265269        this->notificationLists_.erase(identifier);
    266 
    267         // If the map is not the map of all notifications, delete it.
    268         if(map != &this->allNotificationsList_)
    269             delete map;
    270270
    271271        COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.