Fix todo and only unload listener from the last add-on.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler
2011-07-25 05:07:26 +00:00
parent f4f30311aa
commit 898878314d
3 changed files with 11 additions and 9 deletions
+7 -7
View File
@@ -2047,18 +2047,18 @@ Desktop::RedrawBackground()
bool
Desktop::ReloadDecor()
Desktop::ReloadDecor(DecorAddOn* oldDecor)
{
AutoWriteLocker _(fWindowLock);
bool returnValue = true;
// TODO it is assumed all listeners are registered by one decor
// unregister old listeners
const DesktopListenerDLList& currentListeners = GetDesktopListenerList();
for (DesktopListener* listener = currentListeners.First();
listener != NULL; listener = currentListeners.GetNext(listener))
UnregisterListener(listener);
if (oldDecor != NULL) {
const DesktopListenerList* oldListeners
= &oldDecor->GetDesktopListeners();
for (int i = 0; i < oldListeners->CountItems(); i++)
UnregisterListener(oldListeners->ItemAt(i));
}
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
window = window->NextWindow(kAllWindowList)) {
+2 -1
View File
@@ -39,6 +39,7 @@
class BMessage;
class DecorAddOn;
class DrawingEngine;
class HWInterface;
class ServerApp;
@@ -221,7 +222,7 @@ public:
void Redraw();
void RedrawBackground();
bool ReloadDecor();
bool ReloadDecor(DecorAddOn* oldDecor);
BRegion& BackgroundRegion()
{ return fBackgroundRegion; }
+2 -1
View File
@@ -243,13 +243,14 @@ DecorManager::SetDecorator(BString path, Desktop* desktop)
return error == B_OK ? B_ERROR : error;
DecorAddOn* oldDecor = fCurrentDecor;
BString oldPath = fCurrentDecorPath;
image_id oldImage = fCurrentDecor->ImageID();
fCurrentDecor = newDecor;
fCurrentDecorPath = path.String();
if (desktop->ReloadDecor()) {
if (desktop->ReloadDecor(oldDecor)) {
// now safe to unload all old decorator data
// saves us from deleting oldDecor...
unload_add_on(oldImage);