Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5d36c47e
Commit
5d36c47e
authored
Mar 16, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richedit: Fixed object leaks generated by context creation & destruction.
parent
33d7cea1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
23 deletions
+15
-23
caret.c
dlls/riched20/caret.c
+2
-3
context.c
dlls/riched20/context.c
+2
-1
editor.h
dlls/riched20/editor.h
+1
-1
paint.c
dlls/riched20/paint.c
+1
-1
para.c
dlls/riched20/para.c
+2
-5
run.c
dlls/riched20/run.c
+2
-2
wrap.c
dlls/riched20/wrap.c
+5
-10
No files found.
dlls/riched20/caret.c
View file @
5d36c47e
...
...
@@ -215,9 +215,8 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
*
height
=
pSizeRun
->
member
.
run
.
nAscent
+
pSizeRun
->
member
.
run
.
nDescent
;
*
x
=
run
->
member
.
run
.
pt
.
x
+
sz
.
cx
;
*
y
=
para
->
member
.
para
.
nYPos
+
row
->
member
.
row
.
nBaseline
+
pSizeRun
->
member
.
run
.
pt
.
y
-
pSizeRun
->
member
.
run
.
nAscent
-
ME_GetYScrollPos
(
editor
);
ME_DestroyContext
(
&
c
);
ReleaseDC
(
editor
->
hWnd
,
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
return
;
}
}
...
...
dlls/riched20/context.c
View file @
5d36c47e
...
...
@@ -33,7 +33,8 @@ void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
c
->
dpi
.
cy
=
GetDeviceCaps
(
hDC
,
LOGPIXELSY
);
}
void
ME_DestroyContext
(
ME_Context
*
c
)
void
ME_DestroyContext
(
ME_Context
*
c
,
HWND
hWnd
)
{
if
(
hWnd
)
ReleaseDC
(
hWnd
,
c
->
hDC
);
DeleteObject
(
c
->
hbrMargin
);
}
dlls/riched20/editor.h
View file @
5d36c47e
...
...
@@ -190,7 +190,7 @@ void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor);
BOOL
ME_ArrowKey
(
ME_TextEditor
*
ed
,
int
nVKey
,
BOOL
extend
,
BOOL
ctrl
);
void
ME_InitContext
(
ME_Context
*
c
,
ME_TextEditor
*
editor
,
HDC
hDC
);
void
ME_DestroyContext
(
ME_Context
*
c
);
void
ME_DestroyContext
(
ME_Context
*
c
,
HWND
release
);
ME_Style
*
GetInsertStyle
(
ME_TextEditor
*
editor
,
int
nCursor
);
void
ME_MustBeWrapped
(
ME_Context
*
c
,
ME_DisplayItem
*
para
);
void
ME_GetCursorCoordinates
(
ME_TextEditor
*
editor
,
ME_Cursor
*
pCursor
,
...
...
dlls/riched20/paint.c
View file @
5d36c47e
...
...
@@ -91,7 +91,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
if
(
editor
->
nTotalLength
!=
editor
->
nLastTotalLength
)
ME_SendRequestResize
(
editor
,
FALSE
);
editor
->
nLastTotalLength
=
editor
->
nTotalLength
;
ME_DestroyContext
(
&
c
);
ME_DestroyContext
(
&
c
,
NULL
);
}
void
ME_Repaint
(
ME_TextEditor
*
editor
)
...
...
dlls/riched20/para.c
View file @
5d36c47e
...
...
@@ -28,7 +28,6 @@ static const WCHAR wszParagraphSign[] = {0xB6, 0};
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
)
{
ME_Context
c
;
HDC
hDC
;
PARAFORMAT2
fmt
;
CHARFORMAT2W
cf
;
LOGFONTW
lf
;
...
...
@@ -38,9 +37,8 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
ME_DisplayItem
*
run
;
ME_Style
*
style
;
hDC
=
GetDC
(
editor
->
hWnd
);
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
)
);
ME_InitContext
(
&
c
,
editor
,
hDC
);
hf
=
(
HFONT
)
GetStockObject
(
SYSTEM_FONT
);
assert
(
hf
);
GetObjectW
(
hf
,
sizeof
(
LOGFONTW
),
&
lf
);
...
...
@@ -85,8 +83,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
text
->
pLast
->
member
.
para
.
nCharOfs
=
1
;
ME_DestroyContext
(
&
c
);
ReleaseDC
(
editor
->
hWnd
,
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
}
void
ME_MarkAllForWrapping
(
ME_TextEditor
*
editor
)
...
...
dlls/riched20/run.c
View file @
5d36c47e
...
...
@@ -551,7 +551,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
{
SIZE
sz
;
ME_GetOLEObjectSize
(
&
c
,
run
,
&
sz
);
ReleaseDC
(
editor
->
hWnd
,
c
.
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
if
(
cx
<
sz
.
cx
/
2
)
return
0
;
return
1
;
...
...
@@ -580,7 +580,7 @@ int ME_CharFromPointCursor(ME_TextEditor *editor, int cx, ME_Run *run)
ME_DestroyString
(
strRunText
);
ME_UnselectStyleFont
(
&
c
,
run
->
style
,
hOldFont
);
ReleaseDC
(
editor
->
hWnd
,
c
.
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
return
fit
;
}
...
...
dlls/riched20/wrap.c
View file @
5d36c47e
...
...
@@ -467,14 +467,12 @@ static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
}
BOOL
ME_WrapMarkedParagraphs
(
ME_TextEditor
*
editor
)
{
HWND
hWnd
=
editor
->
hWnd
;
HDC
hDC
=
GetDC
(
hWnd
);
ME_DisplayItem
*
item
;
ME_Context
c
;
BOOL
bModified
=
FALSE
;
int
yStart
=
-
1
,
yEnd
=
-
1
;
ME_InitContext
(
&
c
,
editor
,
hDC
);
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
)
);
c
.
pt
.
x
=
0
;
c
.
pt
.
y
=
0
;
editor
->
nHeight
=
0
;
...
...
@@ -510,9 +508,8 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
editor
->
nTotalLength
=
c
.
pt
.
y
;
ME_DestroyContext
(
&
c
);
ReleaseDC
(
hWnd
,
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
if
(
bModified
||
editor
->
nTotalLength
<
editor
->
nLastTotalLength
)
ME_InvalidateMarkedParagraphs
(
editor
);
return
bModified
;
...
...
@@ -520,9 +517,8 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) {
void
ME_InvalidateMarkedParagraphs
(
ME_TextEditor
*
editor
)
{
ME_Context
c
;
HDC
hDC
=
GetDC
(
editor
->
hWnd
);
ME_InitContext
(
&
c
,
editor
,
hDC
);
ME_InitContext
(
&
c
,
editor
,
GetDC
(
editor
->
hWnd
)
);
if
(
editor
->
bRedraw
)
{
RECT
rc
=
c
.
rcView
;
...
...
@@ -544,8 +540,7 @@ void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor) {
InvalidateRect
(
editor
->
hWnd
,
&
rc
,
TRUE
);
}
}
ME_DestroyContext
(
&
c
);
ReleaseDC
(
editor
->
hWnd
,
hDC
);
ME_DestroyContext
(
&
c
,
editor
->
hWnd
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment