2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fix crash in radiobutton destruction.

It crashed if the button was destroyed from group _changedCallback.
This commit is contained in:
John Preston
2018-12-05 13:55:56 +04:00
parent b10ccce44a
commit efe3dfad5c
13 changed files with 165 additions and 119 deletions

View File

@@ -594,8 +594,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
Local::writeUserSettings();
Auth().notifications().settingsChanged().notify(change);
};
base::ObservableViewer(
desktop->checkedChanged
desktop->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Global::DesktopNotify());
}) | rpl::start_with_next([=](bool checked) {
@@ -603,8 +602,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
changed(Change::DesktopEnabled);
}, desktop->lifetime());
base::ObservableViewer(
name->entity()->checkedChanged
name->entity()->checkedChanges(
) | rpl::map([=](bool checked) {
if (!checked) {
return dbinvShowNothing;
@@ -619,8 +617,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
changed(Change::ViewParams);
}, name->lifetime());
base::ObservableViewer(
preview->entity()->checkedChanged
preview->entity()->checkedChanges(
) | rpl::map([=](bool checked) {
if (checked) {
return dbinvShowPreview;
@@ -635,8 +632,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
changed(Change::ViewParams);
}, preview->lifetime());
base::ObservableViewer(
sound->checkedChanged
sound->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Global::SoundNotify());
}) | rpl::start_with_next([=](bool checked) {
@@ -644,8 +640,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
changed(Change::SoundEnabled);
}, sound->lifetime());
base::ObservableViewer(
muted->checkedChanged
muted->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Auth().settings().includeMutedCounter());
}) | rpl::start_with_next([=](bool checked) {
@@ -653,14 +648,13 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
changed(Change::IncludeMuted);
}, muted->lifetime());
base::ObservableViewer(
count->checkedChanged
count->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Auth().settings().countUnreadMessages());
}) | rpl::start_with_next([=](bool checked) {
Auth().settings().setCountUnreadMessages(checked);
changed(Change::CountMessages);
}, muted->lifetime());
}, count->lifetime());
base::ObservableViewer(
Auth().notifications().settingsChanged()
@@ -679,8 +673,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
}, desktop->lifetime());
if (native) {
base::ObservableViewer(
native->checkedChanged
native->checkedChanges(
) | rpl::filter([](bool checked) {
return (checked != Global::NativeNotifications());
}) | rpl::start_with_next([=](bool checked) {