Menu

#807 Crash when changing window mode of the ReopenEditor plugin

Next_Release
applied
plugin (16)
Patch
2021-05-08
2019-03-07
No

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.

1 Attachments

Discussion

  • Teodor Petrov

    Teodor Petrov - 2021-05-04

    Is this patch still relevant? I've fixed the ThreadSearch problem, but I don't remember if I did a detach. Probably not.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-04

    The crash is still there, and the patch is valid (although it requires the new event from ticket 777).

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-04

    Can you/we apply the same fix as in [r11999 ] ?

     

    Related

    Commit: [r11999]

  • Miguel Gimenez

    Miguel Gimenez - 2021-05-05

    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.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-07

    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 to placed in Log & others.

     

    Last edit: Miguel Gimenez 2021-05-07
  • Miguel Gimenez

    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.

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-08

    Why do you have virtual void Init(); ? Why is this virtual?

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-08

    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?

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-08

    I'll change them, just wondered if there is some purpose behind the virtual.

    BTW, I have not created the assignment operator recommended by the "rule of three", should I?

    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)

     
  • Teodor Petrov

    Teodor Petrov - 2021-05-08
    • status: open --> applied
    • assigned_to: Teodor Petrov
     
  • Miguel Gimenez

    Miguel Gimenez - 2021-05-08

    I don't get asserts (MSW10, wx3.1.5 64 bits), neither before nor after the patch.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.