Skip to content
Snippets Groups Projects

CommonMessaging: fix unitialized retrieval of MsgSvc

Closed Charles Leggett requested to merge leggett/Gaudi:dev/CommonMsgFix into master
1 file
+ 16
5
Compare changes
  • Side-by-side
  • Inline
@@ -68,11 +68,16 @@ public:
virtual ~CommonMessagingBase() = default;
/// cold functionality
virtual void create_msgStream() const = 0;
virtual void create_msgSvc() const = 0;
/** The standard message service.
* Returns a pointer to the standard message service.
*/
inline const SmartIF<IMessageSvc>& msgSvc() const { return m_msgsvc; }
inline const SmartIF<IMessageSvc>& msgSvc() const
{
if ( UNLIKELY( !m_msgsvc ) ) create_msgSvc();
return m_msgsvc;
}
/// Return an uninitialized MsgStream.
inline MsgStream& msgStream() const
@@ -145,7 +150,7 @@ private:
MSG::Level m_level = MSG::NIL;
/// Pointer to the message service;
SmartIF<IMessageSvc> m_msgsvc;
mutable SmartIF<IMessageSvc> m_msgsvc;
};
template <typename BASE>
@@ -159,6 +164,13 @@ public:
private:
// out-of-line 'cold' functions -- put here so as to not blow up the inline 'hot' functions
void create_msgSvc() const override final
{
// Get default implementation of the message service.
m_msgsvc = this->serviceLocator();
}
void create_msgStream() const override final { m_msgStream.reset( new MsgStream( msgSvc(), this->name() ) ); }
protected:
@@ -167,8 +179,7 @@ protected:
{
if ( !m_commonMessagingReady ) {
if ( !m_msgsvc ) {
// Get default implementation of the message service.
m_msgsvc = this->serviceLocator();
create_msgSvc();
}
create_msgStream();
m_level = MSG::Level( m_msgStream.get() ? m_msgStream->level() : MSG::NIL );
Loading