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
|
bool
|
||||||
Desktop::ReloadDecor()
|
Desktop::ReloadDecor(DecorAddOn* oldDecor)
|
||||||
{
|
{
|
||||||
AutoWriteLocker _(fWindowLock);
|
AutoWriteLocker _(fWindowLock);
|
||||||
|
|
||||||
bool returnValue = true;
|
bool returnValue = true;
|
||||||
|
|
||||||
// TODO it is assumed all listeners are registered by one decor
|
if (oldDecor != NULL) {
|
||||||
// unregister old listeners
|
const DesktopListenerList* oldListeners
|
||||||
const DesktopListenerDLList& currentListeners = GetDesktopListenerList();
|
= &oldDecor->GetDesktopListeners();
|
||||||
for (DesktopListener* listener = currentListeners.First();
|
for (int i = 0; i < oldListeners->CountItems(); i++)
|
||||||
listener != NULL; listener = currentListeners.GetNext(listener))
|
UnregisterListener(oldListeners->ItemAt(i));
|
||||||
UnregisterListener(listener);
|
}
|
||||||
|
|
||||||
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
for (Window* window = fAllWindows.FirstWindow(); window != NULL;
|
||||||
window = window->NextWindow(kAllWindowList)) {
|
window = window->NextWindow(kAllWindowList)) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
|
|
||||||
|
class DecorAddOn;
|
||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class HWInterface;
|
class HWInterface;
|
||||||
class ServerApp;
|
class ServerApp;
|
||||||
@@ -221,7 +222,7 @@ public:
|
|||||||
void Redraw();
|
void Redraw();
|
||||||
void RedrawBackground();
|
void RedrawBackground();
|
||||||
|
|
||||||
bool ReloadDecor();
|
bool ReloadDecor(DecorAddOn* oldDecor);
|
||||||
|
|
||||||
BRegion& BackgroundRegion()
|
BRegion& BackgroundRegion()
|
||||||
{ return fBackgroundRegion; }
|
{ return fBackgroundRegion; }
|
||||||
|
|||||||
@@ -243,13 +243,14 @@ DecorManager::SetDecorator(BString path, Desktop* desktop)
|
|||||||
return error == B_OK ? B_ERROR : error;
|
return error == B_OK ? B_ERROR : error;
|
||||||
|
|
||||||
DecorAddOn* oldDecor = fCurrentDecor;
|
DecorAddOn* oldDecor = fCurrentDecor;
|
||||||
|
|
||||||
BString oldPath = fCurrentDecorPath;
|
BString oldPath = fCurrentDecorPath;
|
||||||
image_id oldImage = fCurrentDecor->ImageID();
|
image_id oldImage = fCurrentDecor->ImageID();
|
||||||
|
|
||||||
fCurrentDecor = newDecor;
|
fCurrentDecor = newDecor;
|
||||||
fCurrentDecorPath = path.String();
|
fCurrentDecorPath = path.String();
|
||||||
|
|
||||||
if (desktop->ReloadDecor()) {
|
if (desktop->ReloadDecor(oldDecor)) {
|
||||||
// now safe to unload all old decorator data
|
// now safe to unload all old decorator data
|
||||||
// saves us from deleting oldDecor...
|
// saves us from deleting oldDecor...
|
||||||
unload_add_on(oldImage);
|
unload_add_on(oldImage);
|
||||||
|
|||||||
Reference in New Issue
Block a user