User Frithjofh reported in the forum ( http://forums.codeblocks.org/index.php/topic,23151.0.html ) a crash when changing the ReopenEditor plugin from the log tab mode to the floating window mode.
This is due to an use-after-free issue identical to that of the ThreadSearch plugin described in ticket 777.
Inside ReopenEditor::ShowList() the window is destroyed when processing the cbEVT_ADD_LOG_WINDOW event and inmediately after it is used again, leading to the crash.
The attached patch solves this issue. It needs the patch in ticket 777 as a prerequisite.
Is this patch still relevant? I've fixed the ThreadSearch problem, but I don't remember if I did a detach. Probably not.
The crash is still there, and the patch is valid (although it requires the new event from ticket 777).
Can you/we apply the same fix as in [r11999 ] ?
Related
Commit: [r11999]
I'll study this, but currently I have only small bursts of free time and this need more contiguous time, so I may delay a bit.
This is a first approach, but currently it has a small drawback: when switching from log to dock the contents are lost. I'm working on this and will post the final patch soon.
I have corrected also the settings window text from
placed in Log _others
toplaced in Log & others
.Last edit: Miguel Gimenez 2021-05-07
Done.
This patch works around a crash due to use-after-free of m_pListLog when changing from the log & others pane to a floating window. In otder to keep the information of the dying window a copy is created with the newly created copy constructor.
This patch also fixes a problem with an ampersand in the settings window and a memory leak in ReopenEditor::OnRelease() when in floating mode.
Why do you have
virtual void Init();
? Why is this virtual?I have just followed the original definition, all public methods are virtual. Feel free to remove it, or make Init() private.
BTW, I have not created the assignment operator recommended by the "rule of three", should I?
I'll change them, just wondered if there is some purpose behind the virtual.
Or rule of 5 or rule of 7. I don't follow these. :)
I'm seeing rather strange asserts when a play with opening and closing files.
This happens when I click in the empty space in the list. Are you seeing the same asserts on windows? (not related to the patch)
I don't get asserts (MSW10, wx3.1.5 64 bits), neither before nor after the patch.