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
This commit is contained in:
Michael Lotz
2005-07-18 17:48:32 +00:00
parent 530cb79cf1
commit d1c86c04c1
+10 -10
View File
@@ -545,7 +545,7 @@ RootLayer::AddWinBorder(WinBorder* winBorder)
{ {
if (!winBorder->IsHidden()) if (!winBorder->IsHidden())
{ {
CRITICAL("RootLayer::RemoveWinBorder - winBorder must be hidden\n"); CRITICAL("RootLayer::AddWinBorder - winBorder must be hidden\n");
return; return;
} }
@@ -1936,20 +1936,20 @@ RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
bool RootLayer::get_workspace_windows() bool RootLayer::get_workspace_windows()
{ {
int32 bufferSize = fWinBorderListLength; int32 bufferSize = fWinBorderListLength;
int32 exCount = fWinBorderCount; int32 exCount = fWinBorderCount;
bool present; bool present;
bool newMemory = false; bool newMemory = false;
bool aChange = false; bool aChange = false;
memcpy(fWinBorderList2, fWinBorderList, fWinBorderCount * sizeof(WinBorder*)); memcpy(fWinBorderList2, fWinBorderList, fWinBorderCount * sizeof(WinBorder*));
if (!(ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize))) if (!(ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize)))
{ {
newMemory = true; newMemory = true;
// grow by a factor of 8. // grow by a factor of 8.
fWinBorderListLength = (bufferSize / 8 + 1) * 8; fWinBorderListLength = (bufferSize / 8 + 1) * 8;
fWinBorderList = (WinBorder**)realloc(fWinBorderList, fWinBorderListLength); fWinBorderList = (WinBorder**)realloc(fWinBorderList, fWinBorderListLength * sizeof(WinBorder*));
ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize); ActiveWorkspace()->GetWinBorderList((void**)fWinBorderList, &bufferSize);
} }
@@ -1966,7 +1966,7 @@ bool RootLayer::get_workspace_windows()
} }
// to determine if there was a change in window hierarchy // 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; aChange = true;
if (aChange) if (aChange)
@@ -1991,7 +1991,7 @@ bool RootLayer::get_workspace_windows()
// enlarge 2nd buffer also // enlarge 2nd buffer also
if (newMemory) if (newMemory)
fWinBorderList2 = (WinBorder**)realloc(fWinBorderList2, fWinBorderListLength); fWinBorderList2 = (WinBorder**)realloc(fWinBorderList2, fWinBorderListLength * sizeof(WinBorder*));
//for (int32 i = 0; i < fWinBorderCount; i++) //for (int32 i = 0; i < fWinBorderCount; i++)
//{ //{