File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -1534,22 +1534,20 @@ void ThreadMapPort()
1534
1534
1535
1535
void MapPort (bool fUseUPnP )
1536
1536
{
1537
- static boost::thread* upnp_thread = nullptr ;
1537
+ static std::unique_ptr< boost::thread> upnp_thread;
1538
1538
1539
1539
if (fUseUPnP )
1540
1540
{
1541
1541
if (upnp_thread) {
1542
1542
upnp_thread->interrupt ();
1543
1543
upnp_thread->join ();
1544
- delete upnp_thread;
1545
1544
}
1546
- upnp_thread = new boost::thread (boost::bind (&TraceThread<void (*)()>, " upnp" , &ThreadMapPort));
1545
+ upnp_thread. reset ( new boost::thread (boost::bind (&TraceThread<void (*)()>, " upnp" , &ThreadMapPort) ));
1547
1546
}
1548
1547
else if (upnp_thread) {
1549
1548
upnp_thread->interrupt ();
1550
1549
upnp_thread->join ();
1551
- delete upnp_thread;
1552
- upnp_thread = nullptr ;
1550
+ upnp_thread.reset ();
1553
1551
}
1554
1552
}
1555
1553
You can’t perform that action at this time.
0 commit comments