windoze / tvision

Clone of Turbo Vision library at http://sourceforge.net/projects/tvision, by SET<set@users.sourceforge.net>
GNU General Public License v2.0
8 stars 2 forks source link

windows: crash resizing the console buffer #6

Open tmassimi opened 4 years ago

tmassimi commented 4 years ago

Under Windows, using the TV demo application, a resize of the console buffer let the task crash.

the problem seems to be in file win32scr.cc line 322

old++=src;

when called from TStatusLine::drawSelect, *old is pointing to memory out of the buffer.

removing that line the crash disappears and all seems fine, but I haven't fully understood the logic of this part (why it is writing in *old??), so it would be better if samebody competent reviews the code

set-soft commented 4 years ago

Hi @tmassimi It looks like win32 driver isn't catching the resize event. After a resize the:

void TScreenWin32::CheckSizeBuffer(int oldWidth, int oldHeight)

Should be called to resize the screen buffer. Without a screen buffer you lose the drawing optimizations. I don't know if it has a notable impact. Looking at the code I don't see anything that could be there to catch the window resize event.

Did you try another driver? We have 3.

The WinGr driver has this:

int TDisplayWinGr::testEvents( UINT   message, WPARAM wParam, LPARAM lParam )

Here we at least catch SIZE_MAXIMIZED.

The WinNT driver doesn't use the screenBuffer at all.

I don't have Windows installed, so I can't do much test, if you want to collaborate compilieng and trying solutions I can help you.