[ENHANCEMENT] Remove incorrect assert statement
1. Remove incorrect assert statement. 2. Use standard allocation method instead of Microsoft's obscure one.
This commit is contained in:
parent
685971e3fa
commit
cb0ad2786d
@ -46,11 +46,8 @@ enum
|
|||||||
|
|
||||||
StatusBar::~StatusBar()
|
StatusBar::~StatusBar()
|
||||||
{
|
{
|
||||||
if (NULL != _hloc)
|
if (_lpParts != nullptr)
|
||||||
{
|
delete[] _lpParts;
|
||||||
::LocalUnlock(_hloc);
|
|
||||||
::LocalFree(_hloc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +59,6 @@ void StatusBar::init(HINSTANCE /*hInst*/, HWND /*hPere*/)
|
|||||||
|
|
||||||
void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
|
void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
|
||||||
{
|
{
|
||||||
assert(nbParts > 0);
|
|
||||||
Window::init(hInst, hPere);
|
Window::init(hInst, hPere);
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
@ -84,8 +80,8 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
|
|||||||
_partWidthArray.resize(nbParts, (int) defaultPartWidth);
|
_partWidthArray.resize(nbParts, (int) defaultPartWidth);
|
||||||
|
|
||||||
// Allocate an array for holding the right edge coordinates.
|
// Allocate an array for holding the right edge coordinates.
|
||||||
_hloc = ::LocalAlloc(LHND, sizeof(int) * _partWidthArray.size());
|
if (_partWidthArray.size())
|
||||||
_lpParts = (LPINT)::LocalLock(_hloc);
|
_lpParts = new int[_partWidthArray.size()];
|
||||||
|
|
||||||
RECT rc;
|
RECT rc;
|
||||||
::GetClientRect(_hParent, &rc);
|
::GetClientRect(_hParent, &rc);
|
||||||
|
@ -60,7 +60,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<int> _partWidthArray;
|
std::vector<int> _partWidthArray;
|
||||||
HLOCAL _hloc = NULL;
|
int *_lpParts = nullptr;
|
||||||
LPINT _lpParts = NULL;
|
|
||||||
generic_string _lastSetText;
|
generic_string _lastSetText;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user