Terminal: Fix double-freed memory
The base problem was, that every time I opened KeyMap while a Terminal was opened too, it eventually crashed. I followed along the trace and found that the code first frees the keymap and keymapchars in the _UpdateKeymap() and then calls SetKeymap for every tab opened which also tries to free the old keymap and keymapchars. TermWindow's _UpdateKeymap() method first frees the old keymap and keymapchars: delete fKeymap; delete[] fKeymapChars; and then calls SetKeyMap for every tab which tries to free the old keymap and keymapchars again: for (int32 i = 0; i < fTabView->CountTabs(); i++) { TermView* view = _TermViewAt(i); view->SetKeymap(fKeymap, fKeymapChars); } So TermView simply is not responsible for the memory, it merily has a pointer. Fixes #15502. Change-Id: Id08c863d811fbb72cce9be4c8fff2d3eb5f0064f Reviewed-on: https://review.haiku-os.org/c/haiku/+/2037 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
parent
eeb89ccd8b
commit
a02f7c7bae
|
@ -732,9 +732,6 @@ TermView::SetEncoding(int encoding)
|
|||
void
|
||||
TermView::SetKeymap(const key_map* keymap, const char* chars)
|
||||
{
|
||||
delete fKeymap;
|
||||
delete[] fKeymapChars;
|
||||
|
||||
fKeymap = keymap;
|
||||
fKeymapChars = chars;
|
||||
|
||||
|
|
Loading…
Reference in New Issue