mirror of
https://github.com/reactos/reactos.git
synced 2025-06-25 17:49:43 +00:00
[MSPAINT] Fix memory leak of SelectionModel (#2169)
- Initialize all members in SelectionModel's ctor. - Add SelectionModel's dtor.
This commit is contained in:
parent
1d14463947
commit
3fa95ab912
2 changed files with 27 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
* FILE: base/applications/mspaint/selectionmodel.cpp
|
* FILE: base/applications/mspaint/selectionmodel.cpp
|
||||||
* PURPOSE: Keep track of selection parameters, notify listeners
|
* PURPOSE: Keep track of selection parameters, notify listeners
|
||||||
* PROGRAMMERS: Benedikt Freisen
|
* PROGRAMMERS: Benedikt Freisen
|
||||||
|
* Katayama Hirofumi MZ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *********************************************************/
|
/* INCLUDES *********************************************************/
|
||||||
|
@ -13,11 +14,28 @@
|
||||||
/* FUNCTIONS ********************************************************/
|
/* FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
SelectionModel::SelectionModel()
|
SelectionModel::SelectionModel()
|
||||||
|
: m_hDC(CreateCompatibleDC(NULL))
|
||||||
|
, m_hBm(NULL)
|
||||||
|
, m_hMask(NULL)
|
||||||
|
, m_ptStack(NULL)
|
||||||
|
, m_iPtSP(0)
|
||||||
{
|
{
|
||||||
m_ptStack = NULL;
|
SetRectEmpty(&m_rcSrc);
|
||||||
m_iPtSP = 0;
|
SetRectEmpty(&m_rcDest);
|
||||||
|
}
|
||||||
|
|
||||||
m_hDC = CreateCompatibleDC(NULL);
|
SelectionModel::~SelectionModel()
|
||||||
|
{
|
||||||
|
DeleteDC(m_hDC);
|
||||||
|
ResetPtStack();
|
||||||
|
if (m_hBm)
|
||||||
|
{
|
||||||
|
DeleteObject(m_hBm);
|
||||||
|
}
|
||||||
|
if (m_hMask)
|
||||||
|
{
|
||||||
|
DeleteObject(m_hMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionModel::ResetPtStack()
|
void SelectionModel::ResetPtStack()
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* FILE: base/applications/mspaint/selectionmodel.h
|
* FILE: base/applications/mspaint/selectionmodel.h
|
||||||
* PURPOSE: Keep track of selection parameters, notify listeners
|
* PURPOSE: Keep track of selection parameters, notify listeners
|
||||||
* PROGRAMMERS: Benedikt Freisen
|
* PROGRAMMERS: Benedikt Freisen
|
||||||
|
* Katayama Hirofumi MZ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -39,6 +40,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SelectionModel();
|
SelectionModel();
|
||||||
|
~SelectionModel();
|
||||||
void ResetPtStack();
|
void ResetPtStack();
|
||||||
void PushToPtStack(LONG x, LONG y);
|
void PushToPtStack(LONG x, LONG y);
|
||||||
void CalculateBoundingBoxAndContents(HDC hDCImage);
|
void CalculateBoundingBoxAndContents(HDC hDCImage);
|
||||||
|
@ -64,4 +66,8 @@ public:
|
||||||
LONG GetDestRectLeft();
|
LONG GetDestRectLeft();
|
||||||
LONG GetDestRectTop();
|
LONG GetDestRectTop();
|
||||||
void DrawTextToolText(HDC hDCImage, COLORREF crFg, COLORREF crBg, BOOL bBgTransparent = FALSE);
|
void DrawTextToolText(HDC hDCImage, COLORREF crFg, COLORREF crBg, BOOL bBgTransparent = FALSE);
|
||||||
|
|
||||||
|
private:
|
||||||
|
SelectionModel(const SelectionModel&);
|
||||||
|
SelectionModel& operator=(const SelectionModel&);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue