mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
fixed SIGSEGV when quitting due to deletion of UPnP handler during callback
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7634 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a3af37c7e4
commit
067e5d4fac
2 changed files with 6 additions and 2 deletions
|
@ -1304,7 +1304,10 @@ int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*
|
||||||
// Somehow, this is unreliable. UPNP_DISCOVERY_ADVERTISEMENT_ALIVE events
|
// Somehow, this is unreliable. UPNP_DISCOVERY_ADVERTISEMENT_ALIVE events
|
||||||
// happen with a wrong cookie and... boom!
|
// happen with a wrong cookie and... boom!
|
||||||
// CUPnPControlPoint *upnpCP = static_cast<CUPnPControlPoint *>(Cookie);
|
// CUPnPControlPoint *upnpCP = static_cast<CUPnPControlPoint *>(Cookie);
|
||||||
CUPnPControlPoint *upnpCP = CUPnPControlPoint::s_CtrlPoint;
|
CUPnPControlPoint *upnpCP = CUPnPControlPoint::s_CtrlPoint;
|
||||||
|
|
||||||
|
if(upnpCP == NULL)
|
||||||
|
return 0 ;
|
||||||
|
|
||||||
//fprintf(stderr, "Callback: %d, Cookie: %p\n", EventType, Cookie);
|
//fprintf(stderr, "Callback: %d, Cookie: %p\n", EventType, Cookie);
|
||||||
switch (EventType) {
|
switch (EventType) {
|
||||||
|
|
|
@ -232,7 +232,8 @@ bool upnphandler::shutdown_upnp()
|
||||||
|
|
||||||
//destroy the upnp object
|
//destroy the upnp object
|
||||||
cUPnPControlPoint->~CUPnPControlPoint();
|
cUPnPControlPoint->~CUPnPControlPoint();
|
||||||
} else {
|
cUPnPControlPoint=NULL ;
|
||||||
|
} else {
|
||||||
#ifdef UPNP_DEBUG
|
#ifdef UPNP_DEBUG
|
||||||
std::cerr << "upnphandler::shutdown_upnp() : avoid upnp connection for shutdonws because probably a net flag went down." << std::endl;
|
std::cerr << "upnphandler::shutdown_upnp() : avoid upnp connection for shutdonws because probably a net flag went down." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue