diff options
author | 2018-06-01 08:14:05 -0500 | |
---|---|---|
committer | 2018-06-01 08:14:05 -0500 | |
commit | 71046c63c2a90b4015b5b7948597a743c71d2c9d (patch) | |
tree | 346dcca4710e59a33c755786c9475db6ecfa4442 | |
parent | 2e6f3dd0e94bc22ce067f357b863e2a1a8dcbe97 (diff) |
osdnet: prevent segfault at stop and when selecting device from menu (nw)
-rw-r--r-- | src/emu/dinetwork.cpp | 2 | ||||
-rw-r--r-- | src/osd/osdnet.cpp | 7 | ||||
-rw-r--r-- | src/osd/osdnet.h | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/emu/dinetwork.cpp b/src/emu/dinetwork.cpp index 841a7e2524a..5b84a52c9dd 100644 --- a/src/emu/dinetwork.cpp +++ b/src/emu/dinetwork.cpp @@ -40,6 +40,8 @@ void device_network_interface::set_mac(const char *mac) void device_network_interface::set_interface(int id) { + if(m_dev) + m_dev->close(); m_dev.reset(open_netdev(id, this, (int)(m_bandwidth*1000000/8.0f/1500))); if(!m_dev) { device().logerror("Network interface %d not found\n", id); diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp index 5ce4ab0c096..df01382613d 100644 --- a/src/osd/osdnet.cpp +++ b/src/osd/osdnet.cpp @@ -45,9 +45,12 @@ osd_netdev::osd_netdev(class device_network_interface *ifdev, int rate) osd_netdev::~osd_netdev() { +} + +void osd_netdev::close() +{ m_stop = true; -// nasty hack to prevent Segmentation fault on emulation stop -// m_timer->reset(); + m_timer->reset(); } int osd_netdev::send(uint8_t *buf, int len) diff --git a/src/osd/osdnet.h b/src/osd/osdnet.h index b154d21ef9b..9a61820f0a8 100644 --- a/src/osd/osdnet.h +++ b/src/osd/osdnet.h @@ -21,6 +21,7 @@ public: }; osd_netdev(class device_network_interface *ifdev, int rate); virtual ~osd_netdev(); + void close(); virtual int send(uint8_t *buf, int len); virtual void set_mac(const char *mac); |