mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[WIN32CSR] Get rid of dynamic "LineBuffer": it wasn't being resized properly in all cases, causing corruption of Win32CsrApiHeap. Replaced with fixed buffer (painting a line with multiple TextOutW calls if necessary).
svn path=/trunk/; revision=47163
This commit is contained in:
parent
0a6ca40598
commit
3ffc64878c
1 changed files with 6 additions and 25 deletions
|
@ -22,7 +22,6 @@ typedef struct GUI_CONSOLE_DATA_TAG
|
|||
HFONT Font;
|
||||
unsigned CharWidth;
|
||||
unsigned CharHeight;
|
||||
PWCHAR LineBuffer;
|
||||
BOOL CursorBlinkOn;
|
||||
BOOL ForceCursorOff;
|
||||
CRITICAL_SECTION Lock;
|
||||
|
@ -713,9 +712,6 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create)
|
|||
|
||||
InitializeCriticalSection(&GuiData->Lock);
|
||||
|
||||
GuiData->LineBuffer = (PWCHAR)HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY,
|
||||
Console->Size.X * sizeof(WCHAR));
|
||||
|
||||
GuiData->Font = CreateFontW(LOWORD(GuiData->FontSize),
|
||||
0, //HIWORD(GuiData->FontSize),
|
||||
0,
|
||||
|
@ -895,21 +891,22 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
|||
|
||||
for (Line = TopLine; Line <= BottomLine; Line++)
|
||||
{
|
||||
WCHAR LineBuffer[80];
|
||||
From = ConioCoordToPointer(Buff, LeftChar, Line);
|
||||
Start = LeftChar;
|
||||
To = GuiData->LineBuffer;
|
||||
To = LineBuffer;
|
||||
|
||||
for (Char = LeftChar; Char <= RightChar; Char++)
|
||||
{
|
||||
if (*(From + 1) != LastAttribute)
|
||||
if (*(From + 1) != LastAttribute || (Char - Start == sizeof(LineBuffer) / sizeof(WCHAR)))
|
||||
{
|
||||
TextOutW(hDC,
|
||||
(Start - Buff->ShowX) * GuiData->CharWidth,
|
||||
(Line - Buff->ShowY) * GuiData->CharHeight,
|
||||
GuiData->LineBuffer,
|
||||
LineBuffer,
|
||||
Char - Start);
|
||||
Start = Char;
|
||||
To = GuiData->LineBuffer;
|
||||
To = LineBuffer;
|
||||
Attribute = *(From + 1);
|
||||
if (Attribute != LastAttribute)
|
||||
{
|
||||
|
@ -932,7 +929,7 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
|||
TextOutW(hDC,
|
||||
(Start - Buff->ShowX) * GuiData->CharWidth,
|
||||
(Line - Buff->ShowY) * GuiData->CharHeight,
|
||||
GuiData->LineBuffer,
|
||||
LineBuffer,
|
||||
RightChar - Start + 1);
|
||||
}
|
||||
|
||||
|
@ -1809,22 +1806,6 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
windx = LOWORD(pConInfo->WindowSize);
|
||||
windy = HIWORD(pConInfo->WindowSize);
|
||||
|
||||
if (windx > Console->Size.X)
|
||||
{
|
||||
PWCHAR LineBuffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, windx * sizeof(WCHAR));
|
||||
if (LineBuffer)
|
||||
{
|
||||
HeapFree(Win32CsrApiHeap, 0, GuiData->LineBuffer);
|
||||
GuiData->LineBuffer = LineBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeaveCriticalSection(&ActiveBuffer->Header.Lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (windx != Console->Size.X || windy != Console->Size.Y)
|
||||
{
|
||||
/* resize window */
|
||||
|
|
Loading…
Reference in a new issue