diff --git a/src/libcore/sched_remote.cpp b/src/libcore/sched_remote.cpp index 95f737c5..3b8b2496 100644 --- a/src/libcore/sched_remote.cpp +++ b/src/libcore/sched_remote.cpp @@ -73,6 +73,9 @@ RemoteWorker::RemoteWorker(const std::string &name, Stream *stream) : Worker(nam RemoteWorker::~RemoteWorker() { Log(EDebug, "Shutting down"); + if (!m_reader || !m_mutex || !m_memStream) + return; + LockGuard lock(m_mutex); m_reader->shutdown(); m_memStream->writeShort(StreamBackend::EQuit); diff --git a/src/libcore/sstream.cpp b/src/libcore/sstream.cpp index d63932ad..05729d11 100644 --- a/src/libcore/sstream.cpp +++ b/src/libcore/sstream.cpp @@ -39,6 +39,9 @@ MTS_NAMESPACE_BEGIN +static StatsCounter bytesRcvd("Network", "Bytes received"); +static StatsCounter bytesSent("Network", "Bytes sent"); + namespace { #if defined(WIN32) @@ -155,7 +158,6 @@ SocketStream::~SocketStream() { } void SocketStream::read(void *ptr, size_t size) { - static StatsCounter bytesRcvd("Network", "Bytes received"); const size_t total = size; char *data = (char *) ptr; while (size > 0) { @@ -180,7 +182,6 @@ void SocketStream::read(void *ptr, size_t size) { } void SocketStream::write(const void *ptr, size_t size) { - static StatsCounter bytesSent("Network", "Bytes sent"); const size_t total = size; char *data = (char *) ptr; while (size > 0) {