mirror of https://github.com/PCSX2/pcsx2.git
DEV9: fix crash when closing game window with ethernet disabled
This commit is contained in:
parent
6186676add
commit
cf58a32583
|
@ -280,6 +280,7 @@ TAPAdapter::TAPAdapter()
|
||||||
write.Offset = 0;
|
write.Offset = 0;
|
||||||
write.OffsetHigh = 0;
|
write.OffsetHigh = 0;
|
||||||
write.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
write.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
|
isActive = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -379,10 +380,13 @@ bool TAPAdapter::send(NetPacket* pkt)
|
||||||
}
|
}
|
||||||
TAPAdapter::~TAPAdapter()
|
TAPAdapter::~TAPAdapter()
|
||||||
{
|
{
|
||||||
|
if (!isActive)
|
||||||
|
return;
|
||||||
CloseHandle(read.hEvent);
|
CloseHandle(read.hEvent);
|
||||||
CloseHandle(write.hEvent);
|
CloseHandle(write.hEvent);
|
||||||
TAPSetStatus(htap, FALSE);
|
TAPSetStatus(htap, FALSE);
|
||||||
CloseHandle(htap);
|
CloseHandle(htap);
|
||||||
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//i leave these for reference, in case we need msth :p
|
//i leave these for reference, in case we need msth :p
|
||||||
|
|
|
@ -29,6 +29,7 @@ class TAPAdapter : public NetAdapter
|
||||||
{
|
{
|
||||||
HANDLE htap;
|
HANDLE htap;
|
||||||
OVERLAPPED read,write;
|
OVERLAPPED read,write;
|
||||||
|
bool isActive = false;
|
||||||
public:
|
public:
|
||||||
TAPAdapter();
|
TAPAdapter();
|
||||||
virtual bool blocks();
|
virtual bool blocks();
|
||||||
|
|
Loading…
Reference in New Issue