mail[Wesnoth-commits] r44162 - /trunk/src/network_manager_ana.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by billybiset on July 14, 2010 - 18:13:
Author: billynux
Date: Wed Jul 14 18:13:15 2010
New Revision: 44162

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44162&view=rev
Log:
Fixed a resource deallocation bug in ana.

Modified:
    trunk/src/network_manager_ana.cpp

Modified: trunk/src/network_manager_ana.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_manager_ana.cpp?rev=44162&r1=44161&r2=44162&view=diff
==============================================================================
--- trunk/src/network_manager_ana.cpp (original)
+++ trunk/src/network_manager_ana.cpp Wed Jul 14 18:13:15 2010
@@ -333,6 +333,8 @@
     std::cout << "DEBUG: Terminating an ana_connect_handler...\n";
     mutex_.lock();
     mutex_.unlock();
+    handler_mutex_.lock();
+    handler_mutex_.unlock();
 }
 
 const ana::error_code& ana_connect_handler::error() const
@@ -348,7 +350,7 @@
     if (! error_code)
         std::cout << "DEBUG: Connected.\n";
     else
-        std::cout << "DEBUG: Can't connect.\n";
+        std::cout << "DEBUG: Can't connect. " << error_code << "\n";
 
     error_code_ = error_code;
     mutex_.unlock();
@@ -960,7 +962,7 @@
                                                     size_t              
timeout_ms)
 {
     if ( components_.empty() )
-        throw std::runtime_error("Trying to read but nothing was running.");
+        return 0;
 
     ana_component_set::iterator it;
 
@@ -983,14 +985,12 @@
             ana_multiple_receive_handler handler( components_ );
 
             for (it = components_.begin(); it != components_.end(); ++it )
-            {
-                if ( (*it)->is_server() )
-                    (*it)->server()->set_listener_handler( this );
-                else
-                    (*it)->client()->set_listener_handler( this );
-            }
+                (*it)->listener()->set_listener_handler( &handler );
 
             handler.wait_completion( timeout_ms );
+
+            for (it = components_.begin(); it != components_.end(); ++it )
+                (*it)->listener()->set_listener_handler( this );
 
             if ( handler.error() )
             {




Related Messages


Powered by MHonArc, Updated Thu Jul 15 00:20:05 2010