mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 21:33:38 +00:00
riched20: Don't release the dc when destroying the context.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
16a62fcd87
commit
132a35b822
|
@ -227,12 +227,13 @@ void cursor_coords( ME_TextEditor *editor, ME_Cursor *cursor,
|
|||
ME_Run *size_run = run, *prev;
|
||||
ME_Context c;
|
||||
int run_x;
|
||||
HDC hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
|
||||
assert(~para->nFlags & MEPF_REWRAP);
|
||||
|
||||
row = row_from_cursor( cursor );
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
|
||||
if (!cursor->nOffset && (prev = run_prev( run ))) size_run = prev;
|
||||
|
||||
|
@ -243,6 +244,7 @@ void cursor_coords( ME_TextEditor *editor, ME_Cursor *cursor,
|
|||
*y = c.rcView.top + para->pt.y + row->nBaseline
|
||||
+ run->pt.y - size_run->nAscent - editor->vert_si.nPos;
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,5 +44,4 @@ void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
|
|||
void ME_DestroyContext(ME_Context *c)
|
||||
{
|
||||
select_style( c, NULL );
|
||||
if (c->hDC) ITextHost_TxReleaseDC( c->editor->texthost, c->hDC );
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate)
|
|||
if (oldRgn)
|
||||
DeleteObject(oldRgn);
|
||||
|
||||
c.hDC = NULL;
|
||||
ME_DestroyContext(&c);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,8 +160,9 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
ME_Run *run;
|
||||
ME_Style *style;
|
||||
int eol_len;
|
||||
HDC hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
|
||||
hf = GetStockObject(SYSTEM_FONT);
|
||||
assert(hf);
|
||||
|
@ -221,6 +222,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
wine_rb_init( &editor->marked_paras, para_mark_compare );
|
||||
para_mark_add( editor, para );
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
}
|
||||
|
||||
static void para_mark_rewrap_paras( ME_TextEditor *editor, ME_Paragraph *first, const ME_Paragraph *end )
|
||||
|
|
|
@ -571,10 +571,12 @@ int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, B
|
|||
{
|
||||
ME_Context c;
|
||||
int ret;
|
||||
HDC hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
|
||||
ME_InitContext( &c, editor, ITextHost_TxGetDC( editor->texthost ) );
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
ret = ME_CharFromPointContext( &c, cx, run, closest, visual_order );
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -648,10 +650,12 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visu
|
|||
{
|
||||
ME_Context c;
|
||||
int ret;
|
||||
HDC hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
ret = ME_PointFromCharContext( &c, pRun, nOffset, visual_order );
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1027,10 +1027,12 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
|||
ME_Context c;
|
||||
int totalWidth = editor->nTotalWidth, prev_width;
|
||||
struct repaint_range repaint = { NULL, NULL };
|
||||
HDC hdc;
|
||||
|
||||
if (!editor->marked_paras.root) return FALSE;
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
|
||||
entry = wine_rb_head( editor->marked_paras.root );
|
||||
while (entry)
|
||||
|
@ -1085,6 +1087,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
|||
editor->nTotalWidth = totalWidth;
|
||||
|
||||
ME_DestroyContext(&c);
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
|
||||
if (repaint.start || editor->nTotalLength < editor->nLastTotalLength)
|
||||
para_range_invalidate( editor, repaint.start, repaint.end);
|
||||
|
|
|
@ -939,11 +939,13 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
|
|||
UINT size;
|
||||
SIZE goal, pic;
|
||||
ME_Context c;
|
||||
HDC hdc;
|
||||
|
||||
hr = IOleObject_QueryInterface( run->reobj->obj.poleobj, &IID_IDataObject, (void **)&data );
|
||||
if (FAILED(hr)) return FALSE;
|
||||
|
||||
ME_InitContext( &c, editor, ITextHost_TxGetDC( editor->texthost ) );
|
||||
hdc = ITextHost_TxGetDC( editor->texthost );
|
||||
ME_InitContext( &c, editor, hdc );
|
||||
hr = IDataObject_QueryGetData( data, &fmt );
|
||||
if (hr != S_OK) goto done;
|
||||
|
||||
|
@ -985,6 +987,7 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
|
|||
|
||||
done:
|
||||
ME_DestroyContext( &c );
|
||||
ITextHost_TxReleaseDC( editor->texthost, hdc );
|
||||
HeapFree( GetProcessHeap(), 0, emf_bits );
|
||||
ReleaseStgMedium( &med );
|
||||
IDataObject_Release( data );
|
||||
|
|
Loading…
Reference in a new issue