Moved SLiRP event destruction to the thread to fix the Settings restart crash.

This commit is contained in:
OBattler
2020-10-24 21:32:57 +02:00
parent 17c79fb644
commit 4b7d2422fd

View File

@@ -392,6 +392,9 @@ poll_thread(void *arg)
slirp_log("SLiRP: polling stopped.\n"); slirp_log("SLiRP: polling stopped.\n");
thread_set_event(slirp->poll_state); thread_set_event(slirp->poll_state);
/* Destroy event here to avoid a crash. */
slirp_log("SLiRP: thread ended\n");
thread_destroy_event(slirp->poll_state);
/* Free here instead of immediately freeing the global slirp on the main /* Free here instead of immediately freeing the global slirp on the main
thread to avoid a race condition. */ thread to avoid a race condition. */
slirp_cleanup(slirp->slirp); slirp_cleanup(slirp->slirp);
@@ -451,8 +454,6 @@ net_slirp_close(void)
/* Wait for the thread to finish. */ /* Wait for the thread to finish. */
slirp_log("SLiRP: waiting for thread to end...\n"); slirp_log("SLiRP: waiting for thread to end...\n");
thread_wait_event(slirp->poll_state, -1); thread_wait_event(slirp->poll_state, -1);
slirp_log("SLiRP: thread ended\n");
thread_destroy_event(slirp->poll_state);
} }
/* Shutdown work is done by the thread on its local copy of slirp. */ /* Shutdown work is done by the thread on its local copy of slirp. */