mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Only allow stream/record hotkeys if the UI buttons are enabled
Currently the only thing preventing a user from trying to start multiple streams or recordings is the UI buttons being disabled. The hotkey code allowed the user to bypass that, which for streaming resulted in lots of rtmp output connect threads spawning, which stomped all over each other's data structures and resulted in crashes.
This commit is contained in:
parent
ad23128836
commit
2d60c89a02
|
@ -1786,7 +1786,7 @@ void OBSBasic::CreateHotkeys()
|
|||
[](void *data, obs_hotkey_pair_id, obs_hotkey_t*, bool pressed) \
|
||||
{ \
|
||||
OBSBasic &basic = *static_cast<OBSBasic*>(data); \
|
||||
if (pred && pressed) { \
|
||||
if ((pred) && pressed) { \
|
||||
blog(LOG_INFO, log_action " due to hotkey"); \
|
||||
method(); \
|
||||
return true; \
|
||||
|
@ -1799,9 +1799,11 @@ void OBSBasic::CreateHotkeys()
|
|||
Str("Basic.Main.StartStreaming"),
|
||||
"OBSBasic.StopStreaming",
|
||||
Str("Basic.Main.StopStreaming"),
|
||||
MAKE_CALLBACK(!basic.outputHandler->StreamingActive(),
|
||||
MAKE_CALLBACK(!basic.outputHandler->StreamingActive() &&
|
||||
basic.ui->streamButton->isEnabled(),
|
||||
basic.StartStreaming, "Starting stream"),
|
||||
MAKE_CALLBACK(basic.outputHandler->StreamingActive(),
|
||||
MAKE_CALLBACK(basic.outputHandler->StreamingActive() &&
|
||||
basic.ui->streamButton->isEnabled(),
|
||||
basic.StopStreaming, "Stopping stream"),
|
||||
this, this);
|
||||
LoadHotkeyPair(streamingHotkeys,
|
||||
|
@ -1827,9 +1829,11 @@ void OBSBasic::CreateHotkeys()
|
|||
Str("Basic.Main.StartRecording"),
|
||||
"OBSBasic.StopRecording",
|
||||
Str("Basic.Main.StopRecording"),
|
||||
MAKE_CALLBACK(!basic.outputHandler->RecordingActive(),
|
||||
MAKE_CALLBACK(!basic.outputHandler->RecordingActive() &&
|
||||
!basic.ui->recordButton->isChecked(),
|
||||
basic.StartRecording, "Starting recording"),
|
||||
MAKE_CALLBACK(basic.outputHandler->RecordingActive(),
|
||||
MAKE_CALLBACK(basic.outputHandler->RecordingActive() &&
|
||||
basic.ui->recordButton->isChecked(),
|
||||
basic.StopRecording, "Stopping recording"),
|
||||
this, this);
|
||||
LoadHotkeyPair(recordingHotkeys,
|
||||
|
|
Loading…
Reference in a new issue