Skip to content

Commit

Permalink
Prevent a crash
Browse files Browse the repository at this point in the history
When initializing several analyzers, some mediatic data where recreated
while deleted  data were still accessible. Avoid to initialize several
time the same media. As a consequence, the configuration of a media
cannot be reloaded.
  • Loading branch information
kleag committed May 1, 2024
1 parent c0ca799 commit 61da29a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lima_common/src/common/MediaticData/mediaticData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ void MediaticDataPrivate::initMedias(XMLConfigurationFileParser& configParser,
}

// med_str can be modified below. thus, do not use const reference
// TODO skip media init if already initialized
for (auto med_str: meds)
{
MediaId id(0);
Expand All @@ -461,6 +462,14 @@ void MediaticDataPrivate::initMedias(XMLConfigurationFileParser& configParser,
id = static_cast<MediaId>(std::atoi(configParser.getModuleGroupParamValue("common","mediasIds",med_str).c_str()));
#ifdef DEBUG_CD
LDEBUG << "media '" << med_str.c_str() << "' has id " << id;
if (m_mediasData.find(id) != m_mediasData.end())
{
MDATALOGINIT;
LINFO << "Media" << med_str << "already initialized. Skipping.";
continue;
}


LDEBUG << (void*)this << " initialize string pool";
#endif
}
Expand Down

0 comments on commit 61da29a

Please sign in to comment.