lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
981 stars 388 forks source link

Always initialize context and handler before calling lcm_subscribe #273

Closed sammy-tri closed 5 years ago

sammy-tri commented 5 years ago

This avoids a race condition where a receiving thread could potentially try to handle an incoming message (as far as the C implementation is concerned, we're done subscribing) before the handler is populated (and then trying to run a handler at address 0x0).

ashuang commented 5 years ago

good catch, thanks for the PR