Index: code/branches/notifications/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/branches/notifications/data/gui/scripts/NotificationLayer.lua	(revision 7395)
+++ code/branches/notifications/data/gui/scripts/NotificationLayer.lua	(revision 7398)
@@ -40,5 +40,5 @@
         winMgr:destroyWindow(queue.window)
     end
-    queue = nil
+    P.queueList[name] = nil
 end
 
@@ -194,5 +194,6 @@
     window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. name)
     local frame = tolua.cast(window, "CEGUI::FrameWindow")
-    frame:setCloseButtonEnabled(false)
+    frame:setCloseButtonEnabled(true)
+    orxonox.GUIManager:subscribeEventHelper(frame, "CloseClicked", P.name .. ".closeQueue_clicked")
     frame:setText("NotificationQueue \"" .. name .. "\"")
     root:addChildWindow(window)
@@ -221,5 +222,4 @@
     targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
     targets:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
-    cout(0, horzOffset .. "|" .. targets:getXPosition():asAbsolute(1) .. "|" .. size[2]*2+20)
     horzOffset = horzOffset + size[2]*2+20 + 5
     pane:addChildWindow(targets)
@@ -231,5 +231,4 @@
     save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
     save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
-    cout(0, horzOffset .. "|" .. save:getXPosition():asAbsolute(1))
     orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked")
     pane:addChildWindow(save)
@@ -335,5 +334,5 @@
     local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
     local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
-    local width = window:getXPosition():asAbsolute(1)
+    local width = window:getWidth():asAbsolute(1)
 
     local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
@@ -345,5 +344,4 @@
     local size = getMinTextSize(P.sampleWindow)
     window:setWidth(CEGUI.UDim(0, size[2]*2+20))
-    cout(0, width .. "|" .. size[2]*2+20 .. "|" .. window:getWidth():asAbsolute(1) .. "|" .. save:getXPosition():asAbsolute(1))
     save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
 end
@@ -359,5 +357,5 @@
     local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
     local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
-    local width = window:getXPosition():asAbsolute(1)
+    local width = window:getWidth():asAbsolute(1)
 
     local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
@@ -382,5 +380,5 @@
     local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
     local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
-    local width = window:getXPosition():asAbsolute(1)
+    local width = window:getWidth():asAbsolute(1)
 
     local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
@@ -417,4 +415,17 @@
 function P.leaveEditMode_clicked(e)
     hideMenuSheet(P.name)
+end
+
+function P.closeQueue_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "EditMode/.*")
+    local nameStr = match()
+    local queueName = string.sub(nameStr, 10, string.len(nameStr))
+
+    winMgr:destroyWindow(P.queueList[queueName].edit)
+    P.queueList[queueName].edit = nil
+    orxonox.NotificationManager:getInstance():getQueue(queueName):destroy()
 end
 
Index: code/branches/notifications/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationManager.cc	(revision 7395)
+++ code/branches/notifications/src/modules/notifications/NotificationManager.cc	(revision 7398)
@@ -165,5 +165,5 @@
             this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
 
-        COUT(4) << "Notification (&" << notification << ")unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
+        COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
     }
 
@@ -212,5 +212,5 @@
         // 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.
         bool bAll = set.find(NotificationManager::ALL) != set.end();
-        std::multimap<std::time_t, Notification*> map;
+        std::multimap<std::time_t, Notification*>* map;
         if(bAll)
             this->notificationLists_[index] = &this->allNotificationsList_;
@@ -218,5 +218,5 @@
         {
             this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>;
-            map = *this->notificationLists_[index];
+            map = this->notificationLists_[index];
         }
 
@@ -227,5 +227,5 @@
             {
                 if(!bAll)
-                    map.insert(std::pair<std::time_t, Notification*>(it->first, it->second));
+                    map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
                 std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
                 if(counterIt == this->listenerCounter_.end())
@@ -254,18 +254,18 @@
         std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
 
-        // Make sure all Notifications are removed.
+        // If the map is not the map of all notifications, make sure all Notifications are removed and delete it.
         std::multimap<std::time_t, Notification*>::iterator it = map->begin();
-        while(it != map->end())
-        {
-            this->unregisterNotification(it->second, listener);
-            it = map->begin();
+        if(map != &this->allNotificationsList_)
+        {
+            while(it != map->end())
+            {
+                this->unregisterNotification(it->second, listener);
+                it = map->begin();
+            }
+            delete map;
         }
 
         this->listenerList_.erase(listener);
         this->notificationLists_.erase(identifier);
-
-        // If the map is not the map of all notifications, delete it.
-        if(map != &this->allNotificationsList_)
-            delete map;
 
         COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
Index: code/branches/notifications/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationQueue.cc	(revision 7395)
+++ code/branches/notifications/src/modules/notifications/NotificationQueue.cc	(revision 7398)
@@ -100,4 +100,6 @@
             NotificationManager::getInstance().unregisterListener(this);
             NotificationManager::getInstance().unregisterQueue(this);
+
+            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
         }
     }
@@ -360,4 +362,5 @@
         this->targets_.clear();
 
+        //TODO: Do with SubString.
         std::string* pTemp;
         unsigned int index = 0;
Index: code/branches/notifications/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/branches/notifications/src/modules/notifications/NotificationQueue.h	(revision 7395)
+++ code/branches/notifications/src/modules/notifications/NotificationQueue.h	(revision 7398)
@@ -75,4 +75,6 @@
             NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
             virtual ~NotificationQueue();
+
+            void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export
 
             virtual void tick(float dt); //!< To update from time to time.
