crash invoking data available on built-in reader

The DDSI reader/writer pointers are now returned as out parameters
instead of as a return value, so that the upper-layer reference is set
before any listener can be invoked.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-04-15 11:04:26 +02:00 committed by eboasson
parent c891fdc685
commit 6e2068173a
4 changed files with 42 additions and 40 deletions

View file

@ -472,11 +472,11 @@ dds_create_reader(
ddsrt_mutex_unlock(&sub->m_entity.m_mutex);
thread_state_awake (lookup_thread_state ());
rd->m_rd = new_reader(&rd->m_entity.m_guid, NULL, &sub->m_entity.m_participant->m_guid, tp->m_stopic,
rqos, rhc, dds_reader_status_cb, rd);
ret = new_reader(&rd->m_rd, &rd->m_entity.m_guid, NULL, &sub->m_entity.m_participant->m_guid, tp->m_stopic,
rqos, rhc, dds_reader_status_cb, rd);
ddsrt_mutex_lock(&sub->m_entity.m_mutex);
ddsrt_mutex_lock(&tp->m_entity.m_mutex);
assert (rd->m_rd);
assert (ret == DDS_RETCODE_OK);
thread_state_asleep (lookup_thread_state ());
/* For persistent data register reader with durability */

View file

@ -456,10 +456,10 @@ dds_create_writer(
ddsrt_mutex_unlock (&pub->m_entity.m_mutex);
thread_state_awake (lookup_thread_state ());
wr->m_wr = new_writer(&wr->m_entity.m_guid, NULL, &pub->m_entity.m_participant->m_guid, tp->m_stopic, wqos, wr->m_whc, dds_writer_status_cb, wr);
ret = new_writer(&wr->m_wr, &wr->m_entity.m_guid, NULL, &pub->m_entity.m_participant->m_guid, tp->m_stopic, wqos, wr->m_whc, dds_writer_status_cb, wr);
ddsrt_mutex_lock (&pub->m_entity.m_mutex);
ddsrt_mutex_lock (&tp->m_entity.m_mutex);
assert(wr->m_wr);
assert(ret == DDS_RETCODE_OK);
thread_state_asleep (lookup_thread_state ());
dds_topic_unlock(tp);
dds_publisher_unlock(pub);