When using the set_routes with the registry builder, the shared_ptr of the registry builder should be captured. In the original implementation the api_registery_builder captured this parameter, but as the shared_ptr was not captured it was deleted, causing the http to crash when running in debug. In this implementation the method that use the registry creates a lambda function and inside it calls the set_api_doc method, this allows to catch the shared_ptr so it lives until the function complete. It also replaces the c style cast to static_cast and add a FIXME note to the routes implementation, that handlers should be deleted to prevent memory leak. Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
4.6 KiB
4.6 KiB