From d1c86c04c102ba85cc54dda869a6ab838e4576a3 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 18 Jul 2005 17:48:32 +0000 Subject: [PATCH] Fixed some miss-allocation when getting the the workspace windows. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13754 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/RootLayer.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 7c31a33418..e85680d72f 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -545,7 +545,7 @@ RootLayer::AddWinBorder(WinBorder* winBorder) { if (!winBorder->IsHidden()) { - CRITICAL("RootLayer::RemoveWinBorder - winBorder must be hidden\n"); + CRITICAL("RootLayer::AddWinBorder - winBorder must be hidden\n"); return; } @@ -1936,20 +1936,20 @@ RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel) bool RootLayer::get_workspace_windows() { - int32 bufferSize = fWinBorderListLength; - int32 exCount = fWinBorderCount; - bool present; - bool newMemory = false; - bool aChange = false; + int32 bufferSize = fWinBorderListLength; + int32 exCount = fWinBorderCount; + bool present; + bool newMemory = false; + bool aChange = false; memcpy(fWinBorderList2, fWinBorderList, fWinBorderCount * sizeof(WinBorder*)); if (!(ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize))) { - newMemory = true; + newMemory = true; // grow by a factor of 8. fWinBorderListLength = (bufferSize / 8 + 1) * 8; - fWinBorderList = (WinBorder**)realloc(fWinBorderList, fWinBorderListLength); + fWinBorderList = (WinBorder**)realloc(fWinBorderList, fWinBorderListLength * sizeof(WinBorder*)); ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize); } @@ -1966,7 +1966,7 @@ bool RootLayer::get_workspace_windows() } // to determine if there was a change in window hierarchy - if (exCount != fWinBorderCount || memcmp(fWinBorderList, fWinBorderList2, fWinBorderCount) != 0) + if (exCount != fWinBorderCount || memcmp(fWinBorderList, fWinBorderList2, fWinBorderCount * sizeof(WinBorder*)) != 0) aChange = true; if (aChange) @@ -1991,7 +1991,7 @@ bool RootLayer::get_workspace_windows() // enlarge 2nd buffer also if (newMemory) - fWinBorderList2 = (WinBorder**)realloc(fWinBorderList2, fWinBorderListLength); + fWinBorderList2 = (WinBorder**)realloc(fWinBorderList2, fWinBorderListLength * sizeof(WinBorder*)); //for (int32 i = 0; i < fWinBorderCount; i++) //{