mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix renegade graphical console rendering thread.
The console rendering thread doesn't get shut down as the lfbtextbuffer did not think it had a rendering thread. This causes corruptions to occur when a subsequent resolution change destroys the lfbtextbuffer class instance, but the thread continues to use the class. Lots of undefined behavior occurs as the memory gets reallocated for other purposes.
This commit is contained in:
parent
e9b81ccaa5
commit
81ad72ae89
1 changed files with 4 additions and 2 deletions
|
@ -123,8 +123,10 @@ LFBTextBuffer* CreateLFBTextBuffer(uint8_t* lfb, uint32_t lfbformat,
|
|||
memset(lfb + scansize * y, 0, lfbformat/8UL * xres);
|
||||
ret->emergency_state = false;
|
||||
|
||||
ret->queue_thread = true;
|
||||
if ( !RunKernelThread(kernel_process, LFBTextBuffer__RenderThread, ret) )
|
||||
{
|
||||
ret->queue_thread = false;
|
||||
delete ret;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -166,16 +168,16 @@ LFBTextBuffer::LFBTextBuffer()
|
|||
|
||||
LFBTextBuffer::~LFBTextBuffer()
|
||||
{
|
||||
kthread_mutex_lock(&queue_lock);
|
||||
if ( queue_thread )
|
||||
{
|
||||
TextBufferCmd cmd;
|
||||
cmd.type = TEXTBUFCMD_EXIT;
|
||||
IssueCommand(&cmd);
|
||||
kthread_mutex_lock(&queue_lock);
|
||||
while ( queue_thread )
|
||||
kthread_cond_wait(&queue_exit, &queue_lock);
|
||||
kthread_mutex_unlock(&queue_lock);
|
||||
}
|
||||
kthread_mutex_unlock(&queue_lock);
|
||||
delete[] backbuf;
|
||||
delete[] font;
|
||||
delete[] chars;
|
||||
|
|
Loading…
Add table
Reference in a new issue