add sigc disconnect() to destructor, avoid segfault if use new/delete CUpnpBrowserGui in other menu

Origin commit data
------------------
Commit: 547572e11e
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2020-01-24 (Fri, 24 Jan 2020)
This commit is contained in:
Jacek Jendrzej
2020-01-24 22:04:09 +01:00
committed by vanhofen
parent 61aed38689
commit d79bfbc1a4

View File

@@ -83,8 +83,8 @@ CUpnpBrowserGui::CUpnpBrowserGui()
image = NULL; image = NULL;
sigc::slot0<void> reinit = sigc::mem_fun(this, &CUpnpBrowserGui::Init); sigc::slot0<void> reinit = sigc::mem_fun(this, &CUpnpBrowserGui::Init);
CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(reinit); sigFonts = CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(reinit);
CFrameBuffer::getInstance()->OnAfterSetPallette.connect(reinit); sigPall = CFrameBuffer::getInstance()->OnAfterSetPallette.connect(reinit);
} }
void CUpnpBrowserGui::Init() void CUpnpBrowserGui::Init()
@@ -164,12 +164,16 @@ void CUpnpBrowserGui::Init()
CUpnpBrowserGui::~CUpnpBrowserGui() CUpnpBrowserGui::~CUpnpBrowserGui()
{ {
sigFonts.disconnect();
sigPall.disconnect();
delete m_socket; delete m_socket;
if (dline){ if (dline){
delete dline; dline = NULL; delete dline; dline = NULL;
} }
if (image) if (image){
delete image, image = NULL; delete image, image = NULL;
}
} }
int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/) int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/)