diff --git a/src/clientget.cpp b/src/clientget.cpp index 8afdb54..c57598f 100644 --- a/src/clientget.cpp +++ b/src/clientget.cpp @@ -475,6 +475,9 @@ void gpr_cleanup(std::shared_ptr& ret, std::shared_ptr&& op) std::shared_ptr GetBuilder::_exec_get() { + if(!ctx) + throw std::logic_error("NULL Builder"); + std::shared_ptr ret; assert(_get); @@ -497,6 +500,9 @@ std::shared_ptr GetBuilder::_exec_get() std::shared_ptr PutBuilder::exec() { + if(!ctx) + throw std::logic_error("NULL Builder"); + std::shared_ptr ret; if(!_builder && !_args) @@ -535,6 +541,9 @@ std::shared_ptr PutBuilder::exec() std::shared_ptr RPCBuilder::exec() { + if(!ctx) + throw std::logic_error("NULL Builder"); + std::shared_ptr ret; if(_args && _argument) diff --git a/src/clientintrospect.cpp b/src/clientintrospect.cpp index 62d50b8..6a66a99 100644 --- a/src/clientintrospect.cpp +++ b/src/clientintrospect.cpp @@ -168,6 +168,9 @@ void Connection::handle_GET_FIELD() std::shared_ptr GetBuilder::_exec_info() { + if(!ctx) + throw std::logic_error("NULL Builder"); + std::shared_ptr ret; assert(!_get); diff --git a/src/clientmon.cpp b/src/clientmon.cpp index 1e5a155..d623abd 100644 --- a/src/clientmon.cpp +++ b/src/clientmon.cpp @@ -504,6 +504,9 @@ void Connection::handle_MONITOR() std::shared_ptr MonitorBuilder::exec() { + if(!ctx) + throw std::logic_error("NULL Builder"); + std::shared_ptr ret; ctx->tcp_loop.call([&ret, this]() { diff --git a/src/pvxs/client.h b/src/pvxs/client.h index 846bf28..a0fadf4 100644 --- a/src/pvxs/client.h +++ b/src/pvxs/client.h @@ -399,6 +399,7 @@ protected: std::shared_ptr req; unsigned _prio = 0u; + CommonBase() = default; CommonBase(const std::shared_ptr& ctx, const std::string& name) : ctx(ctx), _name(name) {} ~CommonBase(); @@ -416,6 +417,7 @@ protected: struct Args; std::shared_ptr _args; + PRBase() = default; PRBase(const std::shared_ptr& ctx, const std::string& name) : CommonBase(ctx, name) {} ~PRBase(); @@ -428,6 +430,7 @@ protected: template class CommonBuilder : public Base { protected: + CommonBuilder() = default; constexpr CommonBuilder(const std::shared_ptr& ctx, const std::string& name) : Base(ctx, name) {} inline SubBuilder& _sb() { return static_cast(*this); } public: @@ -475,12 +478,13 @@ public: //! Prepare a remote GET or GET_FIELD (info) operation. class GetBuilder : public detail::CommonBuilder { std::function _result; - bool _get; + bool _get = false; PVXS_API std::shared_ptr _exec_info(); PVXS_API std::shared_ptr _exec_get(); public: + GetBuilder() = default; GetBuilder(const std::shared_ptr& ctx, const std::string& name, bool get) :CommonBuilder{ctx,name}, _get(get) {} //! Callback through which result Value or an error will be delivered. //! The functor is stored in the Operation returned by exec(). @@ -505,6 +509,7 @@ class PutBuilder : public detail::CommonBuilder { std::function _builder; std::function _result; public: + PutBuilder() = default; PutBuilder(const std::shared_ptr& ctx, const std::string& name) :CommonBuilder{ctx,name} {} /** If fetchPresent is true (the default). Then the Value passed to @@ -569,6 +574,7 @@ class RPCBuilder : public detail::CommonBuilder { std::function _result; friend class Context; public: + RPCBuilder() = default; RPCBuilder(const std::shared_ptr& ctx, const std::string& name) :CommonBuilder{ctx,name} {} //! Callback through which result Value or an error will be delivered. //! The functor is stored in the Operation returned by exec(). @@ -614,6 +620,7 @@ class MonitorBuilder : public detail::CommonBuilder& ctx, const std::string& name) :CommonBuilder{ctx,name} {} //! Install event callback //! The functor is stored in the Subscription returned by exec(). @@ -633,7 +640,6 @@ MonitorBuilder Context::monitor(const std::string& name) { return MonitorBuilder class RequestBuilder : public detail::CommonBuilder { public: - RequestBuilder() :CommonBuilder{nullptr,std::string()} {} //! Return composed pvRequest Value build() const { return _buildReq();