Menu

#777 Additional "Plugin Disable" crash with ThreadSearch

Next_Nightly
fixed
Bug_Report
2020-03-28
2018-12-16
Adam
No

As initially reported in the now-closed ticket https://sourceforge.net/p/codeblocks/tickets/774/#479e

When disabling the plugin "ThreadSearch", Code::Blocks consistently and repeatably crashes with a segmentation fault.

Using a debugger, the problem can be isolated to ThreadSearchViewManagerMessagesNotebook::RemoveViewFromManager() (), which is called by OnRelease().

The issue occurs in current -svn (~11530) but does not occur in 17.12 stable. If I have chance, I can attempt a similar bisection to isolate the responsible change, but that may take a while due to my not-powerful machine.

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2019-01-23

    I get the same error (no crash but unexpected closing) with Windows 10 64 bits, wx3.1.2 32 bits and revision 11555.

    The problem arises when reparenting the notebook page in src\plugins\contrib\ThreadSearch\ThreadSearchViewManagerMessagesNotebook.cpp

    void ThreadSearchViewManagerMessagesNotebook::RemoveViewFromManager()
    {
        if ( m_IsManaged == true )
        {
            // Status update
            m_IsManaged = false;
            m_IsShown   = false;
    
            // Removes ThreadSearch panel from C::B Messages notebook
            // Reparent call to avoid m_pThreadSearchView deletion
            CodeBlocksLogEvent evt(cbEVT_REMOVE_LOG_WINDOW, m_pThreadSearchView);
            Manager::Get()->ProcessEvent(evt);
            m_pThreadSearchView->Reparent(Manager::Get()->GetAppWindow());  <----
            m_pThreadSearchView->Show(false);
        }
    }
    

    Last change to this file was done in 2013.

    EDIT: wxWidgets docs state that wxNotebook::RemovePage() must be called before reparenting. The manager calls InfoPane::DeleteNonLogger() who calls DeletePage() and not RemovePage(), so m_pThreadSearchView is deleted before calling Reparent().

     

    Last edit: Miguel Gimenez 2019-01-23
  • Miguel Gimenez

    Miguel Gimenez - 2019-01-23

    In infopane.cpp there is a RemoveNonLogger() function near the DeleteNonLogger(). This function is currently unused.

    I think RemoveNonLogger() should be called when cbEVT_REMOVE_LOG_WINDOW is issued and there should be a new cbEVT_DELETE_LOG_WINDOW event for calling DeleteNonLogger(). This makes the event's name match what it realy does (removing or deleting from log).

    There are only 13 uses of cbEVT_REMOVE_LOG_WINDOW that can be easiliy changed to cbEVT_DELETE_LOG_WINDOW.

     
  • Miguel Gimenez

    Miguel Gimenez - 2019-01-23

    I have just started a thread in the forum requesting comments for the proposed patch.

    http://forums.codeblocks.org/index.php/topic,23061.0.html

     
  • Miguel Gimenez

    Miguel Gimenez - 2019-01-29

    After some comments in the forum this is my proposed patch; it fixes the issue adding a new event that allows removing the window from the log without deletion.

    Probably a plugin rewrite would be a better solution, but the code flow is hard to follow.

     
  • Teodor Petrov

    Teodor Petrov - 2020-03-28
    • labels: --> crash, ThreadSearch
    • status: open --> fixed
    • assigned_to: Teodor Petrov
    • Type: Undefined --> Bug_Report
    • Milestone: Undefined --> Next_Nightly
     
  • Teodor Petrov

    Teodor Petrov - 2020-03-28

    This bug should be fix in master. Hopefully I've not broken something else...

     

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.