Fix crash in log filter when record syntax is omitted MP-613
[metaproxy-moved-to-github.git] / src / filter_session_shared.cpp
index 35e96cd..5fbec9c 100644 (file)
@@ -479,6 +479,7 @@ yf::SessionShared::BackendInstancePtr yf::SessionShared::BackendClass::create_ba
         init_package.move();
     }
     m_no_failed++;
+    m_cond_set_ready.notify_all();
     return null;
 }
 
@@ -561,7 +562,9 @@ void yf::SessionShared::Rep::init(mp::Package &package, const Z_GDU *gdu,
         {
             // first for first one to finish
             while (!bc->m_no_failed && !bc->m_no_succeeded && bc->m_no_init)
-                bc->m_cond_set_ready.wait(bc->m_mutex_backend_class);
+            {
+                bc->m_cond_set_ready.wait(lock);
+            }
         }
     }
     if (create_first_one)
@@ -801,8 +804,7 @@ restart:
                     {
                         if ((*it)->m_in_use)
                         {
-                            bc->m_cond_set_ready.wait(
-                                bc->m_mutex_backend_class);
+                            bc->m_cond_set_ready.wait(lock);
                             restart = true;
                             break;
                         }
@@ -878,7 +880,6 @@ restart:
 
     found_set = new_set;
     found_set->timestamp();
-    found_backend->m_sets.push_back(found_set);
 
     Z_Records *z_records = 0;
 
@@ -945,6 +946,7 @@ restart:
                 package.response() = f_apdu;
             }
             bc->release_backend(found_backend);
+            found_set.reset();
             return; // search error
         }
     }
@@ -956,12 +958,7 @@ restart:
         found_backend.reset();
         goto restart;
     }
-
-#if 0
-    found_set = new_set;
-    found_set->timestamp();
     found_backend->m_sets.push_back(found_set);
-#endif
 }
 
 int yf::SessionShared::Frontend::result_set_ref(ODR o,