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:
@@ -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)) {
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user