[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] haiku: hrev44076 - in src/servers/app: . decorator
From:       anevilyak () gmail ! com
Date:       2012-04-28 20:22:24
Message-ID: 20120428202224.5EB525C0837 () vmrepo ! haiku-os ! org
[Download RAW message or body]

hrev44076 adds 1 changeset to branch 'master'
old head: 2f2f3fa042bf2de464d8318de702db7106b686a2
new head: 03b82a629d6358fc6c4ad3b5bb45793fd028a0f2

----------------------------------------------------------------------------

03b82a6: Fix decorator reload crash.
  
  - SetTopTap() -> SetTopTab().
  - When reloading the decor, if the window in question is borderless,
    short circuit. Previously, we wouldn't allocate a decorator for such
    a window, but would then go through the remaining steps of attempting
    to set the focus/top tab, which would obviously crash. Fixes #8500 and
    possibly others.
  - Add error check that adding tabs to the decorator actually succeeded.

                                      [ Rene Gollent <anevilyak@gmail.com> ]

----------------------------------------------------------------------------

Revision:    hrev44076
Commit:      03b82a629d6358fc6c4ad3b5bb45793fd028a0f2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=03b82a6
Author:      Rene Gollent <anevilyak@gmail.com>
Date:        Sat Apr 28 20:18:46 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/8500

----------------------------------------------------------------------------

3 files changed, 15 insertions(+), 11 deletions(-)
src/servers/app/Window.cpp              |   18 +++++++++++-------
src/servers/app/decorator/Decorator.cpp |    4 ++--
src/servers/app/decorator/Decorator.h   |    4 ++--

----------------------------------------------------------------------------

diff --git a/src/servers/app/Window.cpp b/src/servers/app/Window.cpp
index 4f2ca6e..ffc7556 100644
--- a/src/servers/app/Window.cpp
+++ b/src/servers/app/Window.cpp
@@ -602,10 +602,14 @@ Window::ReloadDecor()
 			Window* window = stack->WindowAt(i);
 			BRegion dirty;
 			DesktopSettings settings(fDesktop);
-			decorator->AddTab(settings, window->Title(), window->Look(),
-				window->Flags(), -1, &dirty);
+			if (decorator->AddTab(settings, window->Title(), window->Look(),
+				window->Flags(), -1, &dirty) == NULL) {
+				delete decorator;
+				return false;
+			}
 		}
-	}
+	} else
+		return true;
 
 	windowBehaviour = gDecorManager.AllocateWindowBehaviour(this);
 	if (windowBehaviour == NULL) {
@@ -624,7 +628,7 @@ Window::ReloadDecor()
 		if (window->IsFocus())
 			decorator->SetFocus(i, true);
 		if (window == stack->TopLayerWindow())
-			decorator->SetTopTap(i);
+			decorator->SetTopTab(i);
 	}
 
 	return true;
@@ -2111,7 +2115,7 @@ Window::DetachFromWindowStack(bool ownStackNeeded)
 	::Decorator* decorator = fCurrentStack->Decorator();
 	if (decorator != NULL) {
 		decorator->RemoveTab(index);
-		decorator->SetTopTap(fCurrentStack->LayerOrder().CountItems() - 1);
+		decorator->SetTopTab(fCurrentStack->LayerOrder().CountItems() - 1);
 	}
 
 	Window* remainingTop = fCurrentStack->TopLayerWindow();
@@ -2230,7 +2234,7 @@ Window::MoveToTopStackLayer()
 		return false;
 	decorator->SetDrawingEngine(fDrawingEngine);
 	SetLook(Look(), NULL);
-	decorator->SetTopTap(PositionInStack());
+	decorator->SetTopTab(PositionInStack());
 	return fCurrentStack->MoveToTopLayer(this);
 }
 
@@ -2248,7 +2252,7 @@ Window::MoveToStackPosition(int32 to, bool isMoving)
 	::Decorator* decorator = Decorator();
 	if (decorator && decorator->MoveTab(index, to, isMoving, &dirty) == false)
 		return false;
-	
+
 	fDesktop->RebuildAndRedrawAfterWindowChange(this, dirty);
 	return true;
 }
diff --git a/src/servers/app/decorator/Decorator.cpp b/src/servers/app/decorator/Decorator.cpp
index 263da19..1bd90bb 100644
--- a/src/servers/app/decorator/Decorator.cpp
+++ b/src/servers/app/decorator/Decorator.cpp
@@ -159,7 +159,7 @@ Decorator::TabAt(const BPoint& where) const
 
 
 void
-Decorator::SetTopTap(int32 tab)
+Decorator::SetTopTab(int32 tab)
 {
 	fTopTab = fTabList.ItemAt(tab);
 }
@@ -404,7 +404,7 @@ Decorator::SetTabLocation(int32 tab, float location, bool isShifting,
 	return false;
 }
 
- 
+
 
 /*!	\brief Changes the focus value of the decorator
 
diff --git a/src/servers/app/decorator/Decorator.h b/src/servers/app/decorator/Decorator.h
index f444a0b..40c740d 100644
--- a/src/servers/app/decorator/Decorator.h
+++ b/src/servers/app/decorator/Decorator.h
@@ -89,11 +89,11 @@ public:
 	virtual	bool			MoveTab(int32 from, int32 to, bool isMoving,
 								BRegion* updateRegion = NULL);
 	virtual int32			TabAt(const BPoint& where) const;
-			Decorator::Tab*	TabAt(int32 index) const 
+			Decorator::Tab*	TabAt(int32 index) const
 								{ return fTabList.ItemAt(index); }
 			int32			CountTabs() const
 								{ return fTabList.CountItems(); }
-			void			SetTopTap(int32 tab);
+			void			SetTopTab(int32 tab);
 
 			void			SetDrawingEngine(DrawingEngine *driver);
 	inline	DrawingEngine*	GetDrawingEngine() const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic