Skip to content

Commit 8fdf1ec

Browse files
JoelKatzvinniefalco
authored andcommitted
Just don't ask. We'll fix this right if this is the issue.
1 parent 906a179 commit 8fdf1ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/messages/data.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ template <class element_type>
8484
element_ptr get() {
8585
boost::lock_guard<boost::recursive_mutex> lock(m_lock);
8686

87-
element_ptr p;
87+
element_ptr p, q;
8888

8989
/*std::cout << "message requested ("
9090
<< m_cur_elements-m_avaliable.size()
@@ -95,7 +95,8 @@ template <class element_type>
9595

9696
if (!m_avaliable.empty()) {
9797
p = m_avaliable.front();
98-
m_avaliable.pop();
98+
q = p;
99+
m_avaliable.pop(); // FIXME can call intrusive_ptr_release(line 217) which can deadlock
99100
m_used[p->get_index()] = p;
100101
} else {
101102
if (m_cur_elements == m_max_elements) {
@@ -210,6 +211,7 @@ class data {
210211
typedef websocketpp::processor::hybi_util::masking_key_type masking_key_type;
211212

212213
friend void intrusive_ptr_add_ref(const data * s) {
214+
boost::unique_lock<boost::mutex> lock(s->m_lock);
213215
++s->m_ref_count;
214216
}
215217

0 commit comments

Comments
 (0)