mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Fix crash on quit from passcode with a box.
This commit is contained in:
@@ -19,18 +19,21 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_slide_animation.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "main/main_session.h"
|
||||
|
||||
namespace Window {
|
||||
|
||||
LockWidget::LockWidget(QWidget *parent) : RpWidget(parent) {
|
||||
LockWidget::LockWidget(QWidget *parent, not_null<Controller*> window)
|
||||
: RpWidget(parent)
|
||||
, _window(window) {
|
||||
show();
|
||||
}
|
||||
|
||||
void LockWidget::setInnerFocus() {
|
||||
if (const auto controller = App::wnd()->sessionController()) {
|
||||
if (const auto controller = _window->sessionController()) {
|
||||
controller->dialogsListFocused().set(false, true);
|
||||
}
|
||||
setFocus();
|
||||
@@ -60,7 +63,7 @@ void LockWidget::animationCallback() {
|
||||
update();
|
||||
if (!_a_show.animating()) {
|
||||
showChildren();
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
_window->widget()->setInnerFocus();
|
||||
|
||||
Ui::showChatsList();
|
||||
|
||||
@@ -94,8 +97,10 @@ void LockWidget::paintContent(Painter &p) {
|
||||
p.fillRect(rect(), st::windowBg);
|
||||
}
|
||||
|
||||
PasscodeLockWidget::PasscodeLockWidget(QWidget *parent)
|
||||
: LockWidget(parent)
|
||||
PasscodeLockWidget::PasscodeLockWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> window)
|
||||
: LockWidget(parent, window)
|
||||
, _passcode(this, st::passcodeInput, tr::lng_passcode_ph())
|
||||
, _submit(this, tr::lng_passcode_submit(), st::passcodeSubmit)
|
||||
, _logout(this, tr::lng_passcode_logout(tr::now)) {
|
||||
@@ -103,7 +108,7 @@ PasscodeLockWidget::PasscodeLockWidget(QWidget *parent)
|
||||
connect(_passcode, &Ui::MaskedInputField::submitted, [=] { submit(); });
|
||||
|
||||
_submit->setClickedCallback([=] { submit(); });
|
||||
_logout->setClickedCallback([] { App::wnd()->onLogout(); });
|
||||
_logout->setClickedCallback([=] { window->widget()->onLogout(); });
|
||||
}
|
||||
|
||||
void PasscodeLockWidget::paintContent(Painter &p) {
|
||||
|
@@ -21,9 +21,11 @@ class CheckView;
|
||||
|
||||
namespace Window {
|
||||
|
||||
class Controller;
|
||||
|
||||
class LockWidget : public Ui::RpWidget {
|
||||
public:
|
||||
LockWidget(QWidget *parent);
|
||||
LockWidget(QWidget *parent, not_null<Controller*> window);
|
||||
|
||||
virtual void setInnerFocus();
|
||||
|
||||
@@ -36,6 +38,7 @@ protected:
|
||||
private:
|
||||
void animationCallback();
|
||||
|
||||
const not_null<Controller*> _window;
|
||||
Ui::Animations::Simple _a_show;
|
||||
bool _showBack = false;
|
||||
QPixmap _cacheUnder, _cacheOver;
|
||||
@@ -44,7 +47,7 @@ private:
|
||||
|
||||
class PasscodeLockWidget : public LockWidget {
|
||||
public:
|
||||
PasscodeLockWidget(QWidget *parent);
|
||||
PasscodeLockWidget(QWidget *parent, not_null<Controller*> window);
|
||||
|
||||
void setInnerFocus() override;
|
||||
|
||||
|
Reference in New Issue
Block a user