Changeset 7398 for code/branches/notifications/src/modules
- Timestamp:
- Sep 10, 2010, 7:50:06 PM (14 years ago)
- Location:
- code/branches/notifications/src/modules/notifications
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/notifications/src/modules/notifications/NotificationManager.cc
r7395 r7398 165 165 this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1; 166 166 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; 168 168 } 169 169 … … 212 212 // 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. 213 213 bool bAll = set.find(NotificationManager::ALL) != set.end(); 214 std::multimap<std::time_t, Notification*> map;214 std::multimap<std::time_t, Notification*>* map; 215 215 if(bAll) 216 216 this->notificationLists_[index] = &this->allNotificationsList_; … … 218 218 { 219 219 this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>; 220 map = *this->notificationLists_[index];220 map = this->notificationLists_[index]; 221 221 } 222 222 … … 227 227 { 228 228 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)); 230 230 std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second); 231 231 if(counterIt == this->listenerCounter_.end()) … … 254 254 std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second; 255 255 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. 257 257 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; 262 266 } 263 267 264 268 this->listenerList_.erase(listener); 265 269 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;270 270 271 271 COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl; -
code/branches/notifications/src/modules/notifications/NotificationQueue.cc
r7395 r7398 100 100 NotificationManager::getInstance().unregisterListener(this); 101 101 NotificationManager::getInstance().unregisterQueue(this); 102 103 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 102 104 } 103 105 } … … 360 362 this->targets_.clear(); 361 363 364 //TODO: Do with SubString. 362 365 std::string* pTemp; 363 366 unsigned int index = 0; -
code/branches/notifications/src/modules/notifications/NotificationQueue.h
r7395 r7398 75 75 NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 76 76 virtual ~NotificationQueue(); 77 78 void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export 77 79 78 80 virtual void tick(float dt); //!< To update from time to time.
Note: See TracChangeset
for help on using the changeset viewer.