Problem: poller_t's deprecated add might throw std::bad_function_call

Issue is reproducible in deprecated add method with empty handler
followed by wait that kicks in (covered by provided unit test).

I would prefer we remove this method completely as maintaining something
that we consider `deprecated` is unnecessary in `draft` API.
This commit is contained in:
Pawel Kurdybacha
2018-04-20 06:16:04 +01:00
parent 85a9805f16
commit c55379d6e2
2 changed files with 17 additions and 1 deletions

View File

@@ -1053,7 +1053,8 @@ namespace zmq
ZMQ_DEPRECATED("from 4.3.0, use overload accepting handler_t instead")
void add (zmq::socket_t &socket, short events, std::function<void(void)> &handler)
{
add (socket, events, [&handler](short) { handler(); });
add (socket, events, handler ? [&handler](short) { handler(); }
: handler_t{});
}
void add (zmq::socket_t &socket, short events, handler_t handler)