Skip to content

Commit

Permalink
Fix warning message logic in DVBSignalMonitor
Browse files Browse the repository at this point in the history
The status value mok is passed to the lambda functions log_message and
update_rmflags via capture. This however captures the value at
the line where the lambda function is defined; it does not copy
the actual value of variable mok resulting in erroneous error messages.
This is now fixed by adding a & to the capture variable, specifying
capture by reference which means that the actual variable value is used.
This bug is introduced in commit 7c6cee5
as part of the continuous fixing of clazy/tidy warnings.
  • Loading branch information
kmdewaal committed Aug 3, 2022
1 parent 7be7e16 commit fd2df57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/recorders/dvbsignalmonitor.cpp
Expand Up @@ -95,15 +95,15 @@ DVBSignalMonitor::DVBSignalMonitor(int db_cardnum, DVBChannel* _channel,
uint64_t rmflags = 0;
bool mok = false;

auto log_message = [mok](const QString& loc, const QString& msg)
auto log_message = [&mok](const QString& loc, const QString& msg)
{
if (mok)
LOG(VB_CHANNEL, LOG_INFO, loc + "Can " + msg);
else
LOG(VB_GENERAL, LOG_WARNING, loc + "Cannot " + msg + ENO);
};

auto update_rmflags = [mok, &rmflags](uint64_t flag)
auto update_rmflags = [&mok, &rmflags](uint64_t flag)
{
if (!mok)
rmflags |= flag;
Expand Down

0 comments on commit fd2df57

Please sign in to comment.