Add PostConfigureStreamButtons

Deadlock free-er button updates
This commit is contained in:
palana 2014-09-16 23:08:37 +02:00
parent b998dd5e18
commit fadce387bb
3 changed files with 15 additions and 0 deletions

View File

@ -1382,12 +1382,21 @@ void OBS::RefreshStreamButtons(bool disable)
void OBS::ConfigureStreamButtons()
{
if (bShuttingDown) return;
if (GetWindowThreadProcessId(hwndMain, nullptr) != GetCurrentThreadId())
return PostConfigureStreamButtons();
RefreshStreamButtons();
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), bStreaming ? Str("MainWindow.StopStream") : Str("MainWindow.StartStream"));
SetWindowText(GetDlgItem(hwndMain, ID_TOGGLERECORDING), bRecording ? Str("MainWindow.StopRecording") : Str("MainWindow.StartRecording"));
SetWindowText(GetDlgItem(hwndMain, ID_TESTSTREAM), bTestStream ? Str("MainWindow.StopTest") : Str("MainWindow.TestStream"));
}
void OBS::PostConfigureStreamButtons()
{
if (hwndMain) PostMessage(hwndMain, OBS_CONFIGURE_STREAM_BUTTONS, 0, 0);
}
void OBS::ReloadSceneCollection()
{
HWND hwndTemp;

View File

@ -423,6 +423,7 @@ enum
OBS_UPDATESTATUSBAR,
OBS_NOTIFICATIONAREA,
OBS_NETWORK_FAILED,
OBS_CONFIGURE_STREAM_BUTTONS,
};
//----------------------------
@ -1099,6 +1100,7 @@ private:
void RefreshStreamButtons(bool disable=false);
void ConfigureStreamButtons();
void PostConfigureStreamButtons();
void ReloadIniSettings();

View File

@ -4182,6 +4182,10 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
App->SetStatusBarData();
break;
case OBS_CONFIGURE_STREAM_BUTTONS:
App->ConfigureStreamButtons();
break;
case OBS_NOTIFICATIONAREA:
// the point is to only perform the show/hide (minimize) or the menu creation if no modal dialogs are opened
// if a modal dialog is topmost, then simply focus it