diff options
author | Petar Jovanovic <petar.jovanovic@imgtec.com> | 2013-05-17 18:50:21 +0200 |
---|---|---|
committer | Petar Jovanovic <petar.jovanovic@imgtec.com> | 2013-05-17 19:58:11 +0200 |
commit | 47ea21f83af03c38cb710ad4204ce38b561dea6b (patch) | |
tree | ebc01535caa3f1faa4070718312e61b905645035 | |
parent | c8eea39074faaaee5e8390e347fec27cbfbbffdb (diff) | |
download | sdk-47ea21f83af03c38cb710ad4204ce38b561dea6b.zip sdk-47ea21f83af03c38cb710ad4204ce38b561dea6b.tar.gz sdk-47ea21f83af03c38cb710ad4204ce38b561dea6b.tar.bz2 |
Prevent SocketStream to be freed twice
In cases when RenderThread failed to start, RenderServer would free the
stream first and then the thread. However, the thread itself also attemps to
free the stream and this caused a crash of the emulator in some corner
cases.
Change-Id: I2e508c37ab0a09c9261b30e59072bf1a44982dfe
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp index c726e00..0acb307 100644 --- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp @@ -106,12 +106,11 @@ int RenderServer::Main() if (!rt) { fprintf(stderr,"Failed to create RenderThread\n"); delete stream; - } - - if (!rt->start()) { + stream = NULL; + } else if (!rt->start()) { fprintf(stderr,"Failed to start RenderThread\n"); - delete stream; delete rt; + rt = NULL; } // @@ -133,10 +132,11 @@ int RenderServer::Main() } } - // insert the added thread to the list - threads.insert(rt); - - DBG("Started new RenderThread\n"); + // if the thread has been created and started, insert it to the list + if (rt) { + threads.insert(rt); + DBG("Started new RenderThread\n"); + } } // |