外部可能直接设置Opened而没有关闭网络接口,导致出错

This commit is contained in:
大石头 2017-04-22 14:19:20 +08:00
parent 16e0ef2985
commit 5238db0cf2
1 changed files with 6 additions and 2 deletions

View File

@ -49,10 +49,14 @@ NetworkInterface::NetworkInterface()
NetworkInterface::~NetworkInterface()
{
// 先关闭接口,再移除,避免空指针
//if (!Opened) Close();
// 外部可能直接设置Opened而没有关闭网络接口导致出错
Opened = true;
Close();
debug_printf("Network::Remove 0x%p\r\n", this);
All.Remove(this);
if (!Opened) Close();
}
bool NetworkInterface::Open()