Use base::weak_qptr / base::make_weak.
This commit is contained in:
@@ -1096,7 +1096,7 @@ void Controller::showMenu() {
|
||||
}
|
||||
_menu->setDestroyedCallback(crl::guard(_window.get(), [
|
||||
this,
|
||||
weakButton = Ui::MakeWeak(_menuToggle.data()),
|
||||
weakButton = base::make_weak(_menuToggle.data()),
|
||||
menu = _menu.get()] {
|
||||
if (_menu == menu && weakButton) {
|
||||
weakButton->setForceRippled(false);
|
||||
|
||||
@@ -315,11 +315,11 @@ ShareBoxResult Shown::shareBox(ShareBoxDescriptor &&descriptor) {
|
||||
};
|
||||
const auto state = wrap->lifetime().make_state<State>();
|
||||
|
||||
const auto weak = QPointer<Ui::RpWidget>(wrap);
|
||||
const auto weak = base::make_weak(wrap);
|
||||
const auto lookup = crl::guard(weak, [state] { return state->stack; });
|
||||
const auto layer = Ui::CreateChild<Ui::LayerStackWidget>(
|
||||
wrap.get(),
|
||||
[=] { return std::make_shared<Show>(weak.data(), lookup); });
|
||||
[=] { return std::make_shared<Show>(weak.get(), lookup); });
|
||||
state->stack = layer;
|
||||
const auto show = layer->showFactory()();
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "base/flat_map.h"
|
||||
#include "base/flat_set.h"
|
||||
#include "base/weak_qptr.h"
|
||||
|
||||
#include "ui/qt_object_factory.h"
|
||||
#include "ui/qt_weak_factory.h"
|
||||
|
||||
#include "scheme.h"
|
||||
#include "logs.h"
|
||||
|
||||
Reference in New Issue
Block a user