From adf4cf5de04c72dc3bc3cd4cfab49990693fe663 Mon Sep 17 00:00:00 2001 From: bluehazzard Date: Mon, 18 May 2020 01:14:20 +0200 Subject: [PATCH] Fix crash when uninstalling the plugin (fix #1, Thanks LETARTARE ) Fix the crash by deleting a pointer. Add also nullptr checks... --- cbBuildTools.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cbBuildTools.cpp b/cbBuildTools.cpp index fcbd524..c656eed 100644 --- a/cbBuildTools.cpp +++ b/cbBuildTools.cpp @@ -74,6 +74,13 @@ void cbBuildTools::OnRelease(bool appShutDown) // which means you must not use any of the SDK Managers // NOTE: after this function, the inherited member variable // m_IsAttached will be FALSE... + + if(m_buildTargetsPanel != nullptr) + { + delete m_buildTargetsPanel; + m_buildTargetsPanel = nullptr; + } + } void cbBuildTools::BuildMenu(wxMenuBar* menuBar) @@ -126,11 +133,17 @@ void cbBuildTools::OnWindowMenu(wxCommandEvent& event) void cbBuildTools::OnProjectActivatedEvent(CodeBlocksEvent& event) { + if(m_buildTargetsPanel == nullptr) + return; + cbProject* pCBProject = event.GetProject(); m_buildTargetsPanel->ActivateProject(pCBProject); } void cbBuildTools::OnProjectCloseEvent(CodeBlocksEvent& event) { + if(m_buildTargetsPanel == nullptr) + return; + m_buildTargetsPanel->ClearView(); }