mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 10:14:13 -05:00
frontend: Remove implicit capture of "this" using "="
Implicitly capturing "this" with the capture default "=" is deprecated
with C++20. We fix this by either explicitly passing this, or by copying
the required members manually.
While this exposes some rather expensive copies like the QList
selectedItems in OBSBasic_Preview, it doesn't introduce them ("=" copies
implicitly).
This commit is contained in:
committed by
Ryan Foster
parent
25f4fc9e70
commit
f6a56227eb
@@ -2835,7 +2835,7 @@ void OBSBasicSettings::LoadHotkeySettings(obs_hotkey_id ignoreKey)
|
||||
}
|
||||
|
||||
hotkeys.emplace_back(registerer_type == OBS_HOTKEY_REGISTERER_FRONTEND, hw);
|
||||
connect(hw, &OBSHotkeyWidget::KeyChanged, this, [=]() {
|
||||
connect(hw, &OBSHotkeyWidget::KeyChanged, this, [this, hotkeysLayout]() {
|
||||
HotkeysChanged();
|
||||
ScanDuplicateHotkeys(hotkeysLayout);
|
||||
});
|
||||
|
||||
@@ -624,7 +624,8 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
|
||||
const char *audio_encoder_id = config_get_string(main->Config(), "AdvOut", "AudioEncoder");
|
||||
int streamTrackIndex = config_get_int(main->Config(), "AdvOut", "TrackIndex") - 1;
|
||||
|
||||
auto handle_multitrack_video_result = [=](std::optional<bool> multitrackVideoResult) {
|
||||
auto handle_multitrack_video_result = [this, type = std::string{type}, is_multitrack_output,
|
||||
multiTrackAudioMixes](std::optional<bool> multitrackVideoResult) {
|
||||
if (multitrackVideoResult.has_value())
|
||||
return multitrackVideoResult.value();
|
||||
|
||||
@@ -635,12 +636,9 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
|
||||
startStreaming.Disconnect();
|
||||
stopStreaming.Disconnect();
|
||||
|
||||
streamOutput = obs_output_create(type, "adv_stream", nullptr, nullptr);
|
||||
streamOutput = obs_output_create(type.c_str(), "adv_stream", nullptr, nullptr);
|
||||
if (!streamOutput) {
|
||||
blog(LOG_WARNING,
|
||||
"Creation of stream output type '%s' "
|
||||
"failed!",
|
||||
type);
|
||||
blog(LOG_WARNING, "Creation of stream output type '%s' failed!", type.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -532,7 +532,7 @@ std::shared_future<void> BasicOutputHandler::SetupMultitrackVideo(obs_service_t
|
||||
return continuation(true);
|
||||
};
|
||||
|
||||
QThreadPool::globalInstance()->start([=, multitrackVideo = multitrackVideo.get(),
|
||||
QThreadPool::globalInstance()->start([=, main = main, multitrackVideo = multitrackVideo.get(),
|
||||
service_name = std::string{service_name}, service = OBSService{service},
|
||||
stream_dump_config = OBSData{stream_dump_config},
|
||||
start_streaming_guard = start_streaming_guard]() mutable {
|
||||
|
||||
@@ -610,7 +610,8 @@ std::shared_future<void> SimpleOutput::SetupStreaming(obs_service_t *service, Se
|
||||
auto audio_bitrate = GetAudioBitrate();
|
||||
auto vod_track_mixer = IsVodTrackEnabled(service) ? std::optional{1} : std::nullopt;
|
||||
|
||||
auto handle_multitrack_video_result = [=](std::optional<bool> multitrackVideoResult) {
|
||||
auto handle_multitrack_video_result = [this, type = std::string{type},
|
||||
service](std::optional<bool> multitrackVideoResult) {
|
||||
if (multitrackVideoResult.has_value())
|
||||
return multitrackVideoResult.value();
|
||||
|
||||
@@ -621,12 +622,9 @@ std::shared_future<void> SimpleOutput::SetupStreaming(obs_service_t *service, Se
|
||||
startStreaming.Disconnect();
|
||||
stopStreaming.Disconnect();
|
||||
|
||||
streamOutput = obs_output_create(type, "simple_stream", nullptr, nullptr);
|
||||
streamOutput = obs_output_create(type.c_str(), "simple_stream", nullptr, nullptr);
|
||||
if (!streamOutput) {
|
||||
blog(LOG_WARNING,
|
||||
"Creation of stream output type '%s' "
|
||||
"failed!",
|
||||
type);
|
||||
blog(LOG_WARNING, "Creation of stream output type '%s' failed!", type.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -493,7 +493,7 @@ void OBSBasic::ColorChange()
|
||||
}
|
||||
};
|
||||
|
||||
auto changedColor = [=](const QColor &color) {
|
||||
auto changedColor = [this, selectedItems](const QColor &color) {
|
||||
if (color.isValid()) {
|
||||
ConfirmColor(ui->sources, color, selectedItems);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user