From b6483cb65cceca59e3230b787e7bfc744532b8a9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 14 Dec 2020 18:48:10 +0400 Subject: [PATCH] Use shared_ptr for sections. --- Telegram/SourceFiles/apiwrap.cpp | 2 +- .../boxes/peers/edit_peer_info_box.cpp | 2 +- Telegram/SourceFiles/core/update_checker.cpp | 2 +- .../SourceFiles/data/data_shared_media.cpp | 2 +- .../SourceFiles/dialogs/dialogs_widget.cpp | 4 +- .../admin_log/history_admin_log_section.cpp | 4 +- .../admin_log/history_admin_log_section.h | 2 +- .../SourceFiles/history/history_widget.cpp | 10 ++--- .../history_view_compose_controls.cpp | 2 +- .../view/history_view_pinned_section.cpp | 4 +- .../view/history_view_pinned_section.h | 2 +- .../view/history_view_replies_section.cpp | 4 +- .../view/history_view_replies_section.h | 2 +- .../view/history_view_scheduled_section.cpp | 4 +- .../view/history_view_scheduled_section.h | 2 +- .../view/history_view_top_bar_widget.cpp | 6 +-- .../info_common_groups_widget.cpp | 4 +- .../common_groups/info_common_groups_widget.h | 2 +- .../SourceFiles/info/info_content_widget.cpp | 2 +- .../SourceFiles/info/info_content_widget.h | 4 +- Telegram/SourceFiles/info/info_controller.cpp | 6 +-- Telegram/SourceFiles/info/info_controller.h | 4 +- .../SourceFiles/info/info_layer_widget.cpp | 2 +- Telegram/SourceFiles/info/info_memento.cpp | 44 +++++++++---------- Telegram/SourceFiles/info/info_memento.h | 20 ++++----- .../SourceFiles/info/info_section_widget.cpp | 2 +- .../SourceFiles/info/info_section_widget.h | 2 +- .../SourceFiles/info/info_wrap_widget.cpp | 20 ++++----- Telegram/SourceFiles/info/info_wrap_widget.h | 10 ++--- .../info/media/info_media_buttons.h | 4 +- .../info/media/info_media_widget.cpp | 4 +- .../info/media/info_media_widget.h | 2 +- .../info/members/info_members_widget.cpp | 4 +- .../info/members/info_members_widget.h | 2 +- .../info/polls/info_polls_results_widget.cpp | 4 +- .../info/polls/info_polls_results_widget.h | 2 +- .../info/profile/info_profile_actions.cpp | 2 +- .../profile/info_profile_inner_widget.cpp | 2 +- .../info/profile/info_profile_members.cpp | 6 +-- .../info/profile/info_profile_widget.cpp | 4 +- .../info/profile/info_profile_widget.h | 2 +- .../info/settings/info_settings_widget.cpp | 4 +- .../info/settings/info_settings_widget.h | 2 +- Telegram/SourceFiles/mainwidget.cpp | 35 +++++++-------- Telegram/SourceFiles/mainwidget.h | 8 ++-- .../window/notifications_manager.cpp | 2 +- .../SourceFiles/window/section_widget.cpp | 2 +- Telegram/SourceFiles/window/section_widget.h | 2 +- .../SourceFiles/window/window_peer_menu.cpp | 2 +- .../window/window_session_controller.cpp | 18 ++++---- .../window/window_session_controller.h | 4 +- Telegram/lib_base | 2 +- Telegram/lib_ui | 2 +- cmake | 2 +- 54 files changed, 147 insertions(+), 152 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 577d0b995..7c94a819f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3412,7 +3412,7 @@ void ApiWrap::jumpToHistoryDate(not_null peer, const QDate &date) { // requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) { // Ui::hideLayer(); // App::wnd()->sessionController()->showSection( -// std::make_unique(feed, result)); +// std::make_shared(feed, result)); // }); //} diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index a4df0596a..d78421756 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -1002,7 +1002,7 @@ void Controller::fillManageSection() { if (hasRecentActions) { auto callback = [=] { _navigation->showSection( - std::make_unique(channel)); + std::make_shared(channel)); }; AddButtonWithCount( _controls.buttonsLayout, diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index 4863ea4ce..c4e94f8d9 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -1591,7 +1591,7 @@ void UpdateApplication() { if (const auto window = App::wnd()) { if (const auto controller = window->sessionController()) { controller->showSection( - std::make_unique( + std::make_shared( Info::Settings::Tag{ controller->session().user() }, Info::Section::SettingsType::Advanced), Window::SectionShow()); diff --git a/Telegram/SourceFiles/data/data_shared_media.cpp b/Telegram/SourceFiles/data/data_shared_media.cpp index 9c988dd3b..e1dc70e52 100644 --- a/Telegram/SourceFiles/data/data_shared_media.cpp +++ b/Telegram/SourceFiles/data/data_shared_media.cpp @@ -56,7 +56,7 @@ void SharedMediaShowOverview( return; } } - windows.front()->showSection(std::make_unique( + windows.front()->showSection(std::make_shared( history->peer, Info::Section(type))); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index ecd92806d..508e325aa 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -1776,7 +1776,7 @@ bool Widget::onCancelSearch() { if (const auto peer = _searchInChat.peer()) { Ui::showPeerHistory(peer, ShowAtUnreadMsgId); //} else if (const auto feed = _searchInChat.feed()) { // #feed - // controller()->showSection(std::make_unique(feed)); + // controller()->showSection(std::make_shared(feed)); } else { Unexpected("Empty key in onCancelSearch()."); } @@ -1800,7 +1800,7 @@ void Widget::onCancelSearchInChat() { if (const auto peer = _searchInChat.peer()) { Ui::showPeerHistory(peer, ShowAtUnreadMsgId); //} else if (const auto feed = _searchInChat.feed()) { // #feed - // controller()->showSection(std::make_unique(feed)); + // controller()->showSection(std::make_shared(feed)); } else { Unexpected("Empty key in onCancelSearchInPeer()."); } diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index 4200080ce..57427a6ce 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -371,8 +371,8 @@ void Widget::setupShortcuts() { }, lifetime()); } -std::unique_ptr Widget::createMemento() { - auto result = std::make_unique(channel()); +std::shared_ptr Widget::createMemento() { + auto result = std::make_shared(channel()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.h b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.h index 0bd28fb9b..38c915bd4 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.h +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.h @@ -59,7 +59,7 @@ public: bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; void setInternalState(const QRect &geometry, not_null memento); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 617c42bda..912389af6 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -687,7 +687,7 @@ HistoryWidget::HistoryWidget( cancelReply(lastKeyboardUsed); crl::on_main(this, [=, history = action.history]{ controller->showSection( - std::make_unique(history)); + std::make_shared(history)); }); } else { fastShowAtEnd(action.history); @@ -1502,7 +1502,7 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(const QString &query, U } else if (to.section == Section::Scheduled) { history->setDraft(Data::DraftKey::Scheduled(), std::move(draft)); controller()->showSection( - std::make_unique(history)); + std::make_shared(history)); } else { history->setLocalDraft(std::move(draft)); if (history == _history) { @@ -2070,7 +2070,7 @@ void HistoryWidget::refreshScheduledToggle() { _scheduled->show(); _scheduled->addClickHandler([=] { controller()->showSection( - std::make_unique(_history)); + std::make_shared(_history)); }); orderWidgets(); // Raise drag areas to the top. } else if (_scheduled && !has) { @@ -3880,7 +3880,7 @@ bool HistoryWidget::pushTabbedSelectorToThirdSection( Core::App().settings().setTabbedReplacedWithInfo(false); controller()->resizeForThirdSection(); controller()->showSection( - std::make_unique(), + std::make_shared(), params.withThirdColumn()); return true; } @@ -5387,7 +5387,7 @@ void HistoryWidget::refreshPinnedBarButton(bool many) { const auto id = _pinnedTracker->currentMessageId(); if (id.message) { controller()->showSection( - std::make_unique( + std::make_shared( _history, ((!_migrated || id.message.channel) ? id.message.msg diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 236af8558..623fe13ce 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -1736,7 +1736,7 @@ bool ComposeControls::pushTabbedSelectorToThirdSection( &st::historyRecordVoiceRippleBgActive); _window->resizeForThirdSection(); _window->showSection( - std::make_unique(), + std::make_shared(), params.withThirdColumn()); return true; } diff --git a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp index 8ea4d512f..00199717d 100644 --- a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp @@ -342,8 +342,8 @@ void PinnedWidget::setInternalState( restoreState(memento); } -std::unique_ptr PinnedWidget::createMemento() { - auto result = std::make_unique(history()); +std::shared_ptr PinnedWidget::createMemento() { + auto result = std::make_shared(history()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/history/view/history_view_pinned_section.h b/Telegram/SourceFiles/history/view/history_view_pinned_section.h index ec4250346..0420b4d70 100644 --- a/Telegram/SourceFiles/history/view/history_view_pinned_section.h +++ b/Telegram/SourceFiles/history/view/history_view_pinned_section.h @@ -56,7 +56,7 @@ public: bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; bool showMessage( PeerId peerId, const Window::SectionShow ¶ms, diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index dc8a02bac..89ef5e3d0 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -1367,8 +1367,8 @@ bool RepliesWidget::returnTabbedSelector() { return _composeControls->returnTabbedSelector(); } -std::unique_ptr RepliesWidget::createMemento() { - auto result = std::make_unique(history(), _rootId); +std::shared_ptr RepliesWidget::createMemento() { + auto result = std::make_shared(history(), _rootId); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.h b/Telegram/SourceFiles/history/view/history_view_replies_section.h index fd36d703d..f3a329b9c 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.h +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.h @@ -87,7 +87,7 @@ public: bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; bool showMessage( PeerId peerId, const Window::SectionShow ¶ms, diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index fdd6c5cc7..9191bd357 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -941,8 +941,8 @@ bool ScheduledWidget::returnTabbedSelector() { return _composeControls->returnTabbedSelector(); } -std::unique_ptr ScheduledWidget::createMemento() { - auto result = std::make_unique(history()); +std::shared_ptr ScheduledWidget::createMemento() { + auto result = std::make_shared(history()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h index 0d65a09fd..28f2c3fea 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.h +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.h @@ -72,7 +72,7 @@ public: bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; void setInternalState( const QRect &geometry, diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 4c74a042c..aa9d0ade6 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -493,15 +493,15 @@ void TopBarWidget::infoClicked() { } else if (key.folder()) { _controller->closeFolder(); //} else if (const auto feed = _activeChat.feed()) { // #feed - // _controller->showSection(std::make_unique( + // _controller->showSection(std::make_shared( // feed, // Info::Section(Info::Section::Type::Profile))); } else if (key.peer()->isSelf()) { - _controller->showSection(std::make_unique( + _controller->showSection(std::make_shared( key.peer(), Info::Section(Storage::SharedMediaType::Photo))); } else if (key.peer()->isRepliesChat()) { - _controller->showSection(std::make_unique( + _controller->showSection(std::make_shared( key.peer(), Info::Section(Storage::SharedMediaType::Photo))); } else { diff --git a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp index d9d51639b..f8c1c85ca 100644 --- a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp +++ b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.cpp @@ -87,8 +87,8 @@ void Widget::setInternalState( restoreState(memento); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(user()); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(user()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.h b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.h index ebc5ca940..02d04466d 100644 --- a/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.h +++ b/Telegram/SourceFiles/info/common_groups/info_common_groups_widget.h @@ -64,7 +64,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; InnerWidget *_inner = nullptr; diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index 832c04533..b0e6f628f 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -94,7 +94,7 @@ void ContentWidget::updateControlsGeometry() { } } -std::unique_ptr ContentWidget::createMemento() { +std::shared_ptr ContentWidget::createMemento() { auto result = doCreateMemento(); _controller->saveSearchState(result.get()); return result; diff --git a/Telegram/SourceFiles/info/info_content_widget.h b/Telegram/SourceFiles/info/info_content_widget.h index 9d2a5f423..8eef9f81a 100644 --- a/Telegram/SourceFiles/info/info_content_widget.h +++ b/Telegram/SourceFiles/info/info_content_widget.h @@ -39,7 +39,7 @@ public: virtual bool showInternal( not_null memento) = 0; - std::unique_ptr createMemento(); + std::shared_ptr createMemento(); virtual void setIsStackBottom(bool isStackBottom) { } @@ -96,7 +96,7 @@ private: void updateControlsGeometry(); void refreshSearchField(bool shown); - virtual std::unique_ptr doCreateMemento() = 0; + virtual std::shared_ptr doCreateMemento() = 0; const not_null _controller; diff --git a/Telegram/SourceFiles/info/info_controller.cpp b/Telegram/SourceFiles/info/info_controller.cpp index b7ff86b31..24f9e4f47 100644 --- a/Telegram/SourceFiles/info/info_controller.cpp +++ b/Telegram/SourceFiles/info/info_controller.cpp @@ -123,7 +123,7 @@ PollData *AbstractController::poll() const { } void AbstractController::showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const Window::SectionShow ¶ms) { return parentController()->showSection(std::move(memento), params); } @@ -170,7 +170,7 @@ void Controller::setupMigrationViewer() { const auto section = _section; InvokeQueued(_widget, [=] { window->showSection( - std::make_unique(peer, section), + std::make_shared(peer, section), Window::SectionShow( Window::SectionShow::Way::Backward, anim::type::instant, @@ -261,7 +261,7 @@ void Controller::saveSearchState(not_null memento) { } void Controller::showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const Window::SectionShow ¶ms) { if (!_widget->showInternal(memento.get(), params)) { AbstractController::showSection(std::move(memento), params); diff --git a/Telegram/SourceFiles/info/info_controller.h b/Telegram/SourceFiles/info/info_controller.h index 44926fbee..ff58f95e9 100644 --- a/Telegram/SourceFiles/info/info_controller.h +++ b/Telegram/SourceFiles/info/info_controller.h @@ -136,7 +136,7 @@ public: virtual rpl::producer mediaSourceQueryValue() const; void showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const Window::SectionShow ¶ms = Window::SectionShow()) override; void showBackFromStack( const Window::SectionShow ¶ms = Window::SectionShow()) override; @@ -202,7 +202,7 @@ public: void saveSearchState(not_null memento); void showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const Window::SectionShow ¶ms = Window::SectionShow()) override; void showBackFromStack( const Window::SectionShow ¶ms = Window::SectionShow()) override; diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index 9460b7f05..0c4b30780 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -106,7 +106,7 @@ void LayerWidget::parentResized() { Ui::FocusPersister persister(this); restoreFloatPlayerDelegate(); - auto memento = std::make_unique(std::move(_content)); + auto memento = std::make_shared(std::move(_content)); // We want to call hideSpecialLayer synchronously to avoid glitches, // but we can't destroy LayerStackWidget from its' resizeEvent, diff --git a/Telegram/SourceFiles/info/info_memento.cpp b/Telegram/SourceFiles/info/info_memento.cpp index ba15952f5..84d3aa26c 100644 --- a/Telegram/SourceFiles/info/info_memento.cpp +++ b/Telegram/SourceFiles/info/info_memento.cpp @@ -47,41 +47,41 @@ Memento::Memento(not_null poll, FullMsgId contextId) : Memento(DefaultStack(poll, contextId)) { } -Memento::Memento(std::vector> stack) +Memento::Memento(std::vector> stack) : _stack(std::move(stack)) { } -std::vector> Memento::DefaultStack( +std::vector> Memento::DefaultStack( not_null peer, Section section) { - auto result = std::vector>(); + auto result = std::vector>(); result.push_back(DefaultContent(peer, section)); return result; } -//std::vector> Memento::DefaultStack( // #feed +//std::vector> Memento::DefaultStack( // #feed // not_null feed, // Section section) { -// auto result = std::vector>(); +// auto result = std::vector>(); // result.push_back(DefaultContent(feed, section)); // return result; //} // -std::vector> Memento::DefaultStack( +std::vector> Memento::DefaultStack( Settings::Tag settings, Section section) { - auto result = std::vector>(); - result.push_back(std::make_unique( + auto result = std::vector>(); + result.push_back(std::make_shared( settings.self, section.settingsType())); return result; } -std::vector> Memento::DefaultStack( +std::vector> Memento::DefaultStack( not_null poll, FullMsgId contextId) { - auto result = std::vector>(); - result.push_back(std::make_unique(poll, contextId)); + auto result = std::vector>(); + result.push_back(std::make_shared(poll, contextId)); return result; } @@ -101,8 +101,8 @@ Section Memento::DefaultSection(not_null peer) { // return Section(Section::Type::Profile); //} -std::unique_ptr Memento::Default(not_null peer) { - return std::make_unique(peer, DefaultSection(peer)); +std::shared_ptr Memento::Default(not_null peer) { + return std::make_shared(peer, DefaultSection(peer)); } // // #feed //Memento Memento::Default(Dialogs::Key key) { @@ -112,7 +112,7 @@ std::unique_ptr Memento::Default(not_null peer) { // return Memento(key.feed(), DefaultSection(key)); //} -std::unique_ptr Memento::DefaultContent( +std::shared_ptr Memento::DefaultContent( not_null peer, Section section) { if (auto to = peer->migrateTo()) { @@ -123,32 +123,32 @@ std::unique_ptr Memento::DefaultContent( switch (section.type()) { case Section::Type::Profile: - return std::make_unique( + return std::make_shared( peer, migratedPeerId); case Section::Type::Media: - return std::make_unique( + return std::make_shared( peer, migratedPeerId, section.mediaType()); case Section::Type::CommonGroups: - return std::make_unique(peer->asUser()); + return std::make_shared(peer->asUser()); case Section::Type::Members: - return std::make_unique( + return std::make_shared( peer, migratedPeerId); } Unexpected("Wrong section type in Info::Memento::DefaultContent()"); } // -//std::unique_ptr Memento::DefaultContent( // #feed +//std::shared_ptr Memento::DefaultContent( // #feed // not_null feed, // Section section) { // switch (section.type()) { // case Section::Type::Profile: -// return std::make_unique(feed); +// return std::make_shared(feed); // case Section::Type::Channels: -// return std::make_unique(feed); +// return std::make_shared(feed); // } // Unexpected("Wrong feed section in Info::Memento::DefaultContent()"); //} @@ -179,7 +179,7 @@ object_ptr Memento::createLayer( return nullptr; } -std::vector> Memento::takeStack() { +std::vector> Memento::takeStack() { return std::move(_stack); } diff --git a/Telegram/SourceFiles/info/info_memento.h b/Telegram/SourceFiles/info/info_memento.h index bcd9b6aac..2b58224df 100644 --- a/Telegram/SourceFiles/info/info_memento.h +++ b/Telegram/SourceFiles/info/info_memento.h @@ -37,7 +37,7 @@ public: //Memento(not_null feed, Section section); // #feed Memento(Settings::Tag settings, Section section); Memento(not_null poll, FullMsgId contextId); - explicit Memento(std::vector> stack); + explicit Memento(std::vector> stack); object_ptr createWidget( QWidget *parent, @@ -52,7 +52,7 @@ public: int stackSize() const { return int(_stack.size()); } - std::vector> takeStack(); + std::vector> takeStack(); not_null content() { Expects(!_stack.empty()); @@ -62,33 +62,33 @@ public: static Section DefaultSection(not_null peer); //static Section DefaultSection(Dialogs::Key key); // #feed - static std::unique_ptr Default(not_null peer); + static std::shared_ptr Default(not_null peer); //static Memento Default(Dialogs::Key key); // #feed ~Memento(); private: - static std::vector> DefaultStack( + static std::vector> DefaultStack( not_null peer, Section section); - //static std::vector> DefaultStack( // #feed + //static std::vector> DefaultStack( // #feed // not_null feed, // Section section); - static std::vector> DefaultStack( + static std::vector> DefaultStack( Settings::Tag settings, Section section); - static std::vector> DefaultStack( + static std::vector> DefaultStack( not_null poll, FullMsgId contextId); - //static std::unique_ptr DefaultContent( // #feed + //static std::shared_ptr DefaultContent( // #feed // not_null feed, // Section section); - static std::unique_ptr DefaultContent( + static std::shared_ptr DefaultContent( not_null peer, Section section); - std::vector> _stack; + std::vector> _stack; }; diff --git a/Telegram/SourceFiles/info/info_section_widget.cpp b/Telegram/SourceFiles/info/info_section_widget.cpp index b679bcc7c..99b289bf9 100644 --- a/Telegram/SourceFiles/info/info_section_widget.cpp +++ b/Telegram/SourceFiles/info/info_section_widget.cpp @@ -92,7 +92,7 @@ bool SectionWidget::showInternal( return _content->showInternal(memento, params); } -std::unique_ptr SectionWidget::createMemento() { +std::shared_ptr SectionWidget::createMemento() { return _content->createMemento(); } diff --git a/Telegram/SourceFiles/info/info_section_widget.h b/Telegram/SourceFiles/info/info_section_widget.h index 79d5cf7e0..7a4e470c2 100644 --- a/Telegram/SourceFiles/info/info_section_widget.h +++ b/Telegram/SourceFiles/info/info_section_widget.h @@ -48,7 +48,7 @@ public: bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; object_ptr moveContentToLayer( QRect bodyGeometry) override; diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 22ab43419..9adf008f9 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -50,8 +50,8 @@ const style::InfoTopBar &TopBarStyle(Wrap wrap) { } // namespace struct WrapWidget::StackItem { - std::unique_ptr section; -// std::unique_ptr anotherTab; + std::shared_ptr section; +// std::shared_ptr anotherTab; }; WrapWidget::WrapWidget( @@ -96,7 +96,7 @@ void WrapWidget::setupShortcuts() { } void WrapWidget::restoreHistoryStack( - std::vector> stack) { + std::vector> stack) { Expects(!stack.empty()); Expects(!hasStackHistory()); @@ -188,7 +188,7 @@ void WrapWidget::injectActivePeerProfile(not_null peer) { //} void WrapWidget::injectActiveProfileMemento( - std::unique_ptr memento) { + std::shared_ptr memento) { auto injected = StackItem(); injected.section = std::move(memento); _historyStack.insert( @@ -712,13 +712,13 @@ rpl::producer WrapWidget::selectedListValue() const { // Was done for top level tabs support. // -//std::unique_ptr WrapWidget::createTabMemento( +//std::shared_ptr WrapWidget::createTabMemento( // Tab tab) { // switch (tab) { -// case Tab::Profile: return std::make_unique( +// case Tab::Profile: return std::make_shared( // _controller->peerId(), // _controller->migratedPeerId()); -// case Tab::Media: return std::make_unique( +// case Tab::Media: return std::make_shared( // _controller->peerId(), // _controller->migratedPeerId(), // Media::Type::Photo); @@ -884,8 +884,8 @@ void WrapWidget::highlightTopBar() { } } -std::unique_ptr WrapWidget::createMemento() { - auto stack = std::vector>(); +std::shared_ptr WrapWidget::createMemento() { + auto stack = std::vector>(); stack.reserve(_historyStack.size() + 1); for (auto &stackItem : base::take(_historyStack)) { stack.push_back(std::move(stackItem.section)); @@ -895,7 +895,7 @@ std::unique_ptr WrapWidget::createMemento() { // We're not in valid state anymore and supposed to be destroyed. _controller = nullptr; - return std::make_unique(std::move(stack)); + return std::make_shared(std::move(stack)); } rpl::producer WrapWidget::desiredHeightValue() const { diff --git a/Telegram/SourceFiles/info/info_wrap_widget.h b/Telegram/SourceFiles/info/info_wrap_widget.h index 13929ded2..76afa06a4 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.h +++ b/Telegram/SourceFiles/info/info_wrap_widget.h @@ -101,7 +101,7 @@ public: not_null memento, const Window::SectionShow ¶ms) override; bool showBackFromStackInternal(const Window::SectionShow ¶ms); - std::unique_ptr createMemento() override; + std::shared_ptr createMemento() override; rpl::producer desiredHeightValue() const override; @@ -146,10 +146,10 @@ private: void injectActivePeerProfile(not_null peer); //void injectActiveFeedProfile(not_null feed); // #feed void injectActiveProfileMemento( - std::unique_ptr memento); + std::shared_ptr memento); void checkBeforeClose(Fn close); void restoreHistoryStack( - std::vector> stack); + std::vector> stack); bool hasStackHistory() const { return !_historyStack.empty(); } @@ -178,7 +178,7 @@ private: //void showTab(Tab tab); void showContent(object_ptr content); - //std::unique_ptr createTabMemento(Tab tab); + //std::shared_ptr createTabMemento(Tab tab); object_ptr createContent( not_null memento, not_null controller); @@ -212,7 +212,7 @@ private: base::unique_qptr _topBarMenu; // Tab _tab = Tab::Profile; -// std::unique_ptr _anotherTabMemento; +// std::shared_ptr _anotherTabMemento; std::vector _historyStack; rpl::event_stream> _desiredHeights; diff --git a/Telegram/SourceFiles/info/media/info_media_buttons.h b/Telegram/SourceFiles/info/media/info_media_buttons.h index 78e199c02..4e091e515 100644 --- a/Telegram/SourceFiles/info/media/info_media_buttons.h +++ b/Telegram/SourceFiles/info/media/info_media_buttons.h @@ -92,7 +92,7 @@ inline auto AddButton( tracker)->entity(); result->addClickHandler([=] { navigation->showSection( - std::make_unique(peer, Section(type))); + std::make_shared(peer, Section(type))); }); return result; }; @@ -111,7 +111,7 @@ inline auto AddCommonGroupsButton( tracker)->entity(); result->addClickHandler([=] { navigation->showSection( - std::make_unique(user, Section::Type::CommonGroups)); + std::make_shared(user, Section::Type::CommonGroups)); }); return result; }; diff --git a/Telegram/SourceFiles/info/media/info_media_widget.cpp b/Telegram/SourceFiles/info/media/info_media_widget.cpp index 8fa06414c..66df479dd 100644 --- a/Telegram/SourceFiles/info/media/info_media_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_widget.cpp @@ -115,8 +115,8 @@ void Widget::setInternalState( restoreState(memento); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(controller()); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(controller()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/media/info_media_widget.h b/Telegram/SourceFiles/info/media/info_media_widget.h index 1f1632aa1..d09d972b6 100644 --- a/Telegram/SourceFiles/info/media/info_media_widget.h +++ b/Telegram/SourceFiles/info/media/info_media_widget.h @@ -103,7 +103,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; InnerWidget *_inner = nullptr; diff --git a/Telegram/SourceFiles/info/members/info_members_widget.cpp b/Telegram/SourceFiles/info/members/info_members_widget.cpp index 6e1c78603..45747d131 100644 --- a/Telegram/SourceFiles/info/members/info_members_widget.cpp +++ b/Telegram/SourceFiles/info/members/info_members_widget.cpp @@ -79,8 +79,8 @@ void Widget::setInternalState( restoreState(memento); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(controller()); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(controller()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/members/info_members_widget.h b/Telegram/SourceFiles/info/members/info_members_widget.h index 1e43f7c78..23a2eac46 100644 --- a/Telegram/SourceFiles/info/members/info_members_widget.h +++ b/Telegram/SourceFiles/info/members/info_members_widget.h @@ -60,7 +60,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; Profile::Members *_inner = nullptr; diff --git a/Telegram/SourceFiles/info/polls/info_polls_results_widget.cpp b/Telegram/SourceFiles/info/polls/info_polls_results_widget.cpp index e979fd3f4..1d3dcdcdb 100644 --- a/Telegram/SourceFiles/info/polls/info_polls_results_widget.cpp +++ b/Telegram/SourceFiles/info/polls/info_polls_results_widget.cpp @@ -90,8 +90,8 @@ void Widget::setInternalState( restoreState(memento); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(poll(), contextId()); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(poll(), contextId()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/polls/info_polls_results_widget.h b/Telegram/SourceFiles/info/polls/info_polls_results_widget.h index f8a140711..6f3fa8a42 100644 --- a/Telegram/SourceFiles/info/polls/info_polls_results_widget.h +++ b/Telegram/SourceFiles/info/polls/info_polls_results_widget.h @@ -60,7 +60,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; not_null _inner; diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 1413d3ef8..ba4c19842 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -843,7 +843,7 @@ object_ptr SetupChannelMembers( lt_count_decimal, MembersCountValue(channel) | tr::to_count()); auto membersCallback = [=] { - controller->showSection(std::make_unique( + controller->showSection(std::make_shared( channel, Section::Type::Members)); }; diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index e55010909..cf72e9904 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -82,7 +82,7 @@ object_ptr InnerWidget::setupContent( _cover->showSection( ) | rpl::start_with_next([=](Section section) { _controller->showSection( - std::make_unique(_peer, section)); + std::make_shared(_peer, section)); }, _cover->lifetime()); _cover->setOnlineCount(rpl::single(0)); auto details = SetupDetails(_controller, parent, _peer); diff --git a/Telegram/SourceFiles/info/profile/info_profile_members.cpp b/Telegram/SourceFiles/info/profile/info_profile_members.cpp index 0923499d3..f071ab4e3 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members.cpp @@ -342,14 +342,14 @@ void Members::showMembersWithSearch(bool withSearch) { //if (!_searchShown) { // toggleSearch(); //} - auto contentMemento = std::make_unique( + auto contentMemento = std::make_shared( _controller); contentMemento->setState(saveState()); contentMemento->setSearchStartsFocused(withSearch); - auto mementoStack = std::vector>(); + auto mementoStack = std::vector>(); mementoStack.push_back(std::move(contentMemento)); _controller->showSection( - std::make_unique(std::move(mementoStack))); + std::make_shared(std::move(mementoStack))); } //void Members::toggleSearch(anim::type animated) { diff --git a/Telegram/SourceFiles/info/profile/info_profile_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_widget.cpp index d9c25e619..531125813 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_widget.cpp @@ -99,8 +99,8 @@ void Widget::setInternalState( restoreState(memento); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(controller()); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(controller()); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/profile/info_profile_widget.h b/Telegram/SourceFiles/info/profile/info_profile_widget.h index 8e944f44d..6b9af0236 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_widget.h +++ b/Telegram/SourceFiles/info/profile/info_profile_widget.h @@ -66,7 +66,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; InnerWidget *_inner = nullptr; diff --git a/Telegram/SourceFiles/info/settings/info_settings_widget.cpp b/Telegram/SourceFiles/info/settings/info_settings_widget.cpp index 553a2345d..c1fd45cd0 100644 --- a/Telegram/SourceFiles/info/settings/info_settings_widget.cpp +++ b/Telegram/SourceFiles/info/settings/info_settings_widget.cpp @@ -95,8 +95,8 @@ rpl::producer Widget::desiredShadowVisibility() const { : rpl::single(true); } -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(self(), _type); +std::shared_ptr Widget::doCreateMemento() { + auto result = std::make_shared(self(), _type); saveState(result.get()); return result; } diff --git a/Telegram/SourceFiles/info/settings/info_settings_widget.h b/Telegram/SourceFiles/info/settings/info_settings_widget.h index d5be88734..7033edf4a 100644 --- a/Telegram/SourceFiles/info/settings/info_settings_widget.h +++ b/Telegram/SourceFiles/info/settings/info_settings_widget.h @@ -72,7 +72,7 @@ private: void saveState(not_null memento); void restoreState(not_null memento); - std::unique_ptr doCreateMemento() override; + std::shared_ptr doCreateMemento() override; not_null _self; Type _type = Type(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 2172cf0ea..1949de3e3 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -140,8 +140,8 @@ public: } void setThirdSectionMemento( - std::unique_ptr &&memento); - std::unique_ptr takeThirdSectionMemento() { + std::shared_ptr memento); + std::shared_ptr takeThirdSectionMemento() { return std::move(_thirdSectionMemento); } @@ -158,7 +158,7 @@ public: private: PeerData *_peer = nullptr; QPointer _thirdSectionWeak; - std::unique_ptr _thirdSectionMemento; + std::shared_ptr _thirdSectionMemento; }; @@ -187,27 +187,27 @@ public: class StackItemSection : public StackItem { public: StackItemSection( - std::unique_ptr &&memento); + std::shared_ptr memento); StackItemType type() const override { return SectionStackItem; } - std::unique_ptr takeMemento() { + std::shared_ptr takeMemento() { return std::move(_memento); } private: - std::unique_ptr _memento; + std::shared_ptr _memento; }; void StackItem::setThirdSectionMemento( - std::unique_ptr &&memento) { + std::shared_ptr memento) { _thirdSectionMemento = std::move(memento); } StackItemSection::StackItemSection( - std::unique_ptr &&memento) + std::shared_ptr memento) : StackItem(nullptr) , _memento(std::move(memento)) { } @@ -1607,7 +1607,7 @@ void MainWidget::saveSectionInStack() { } void MainWidget::showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms) { if (_mainSection && _mainSection->showInternal( memento.get(), @@ -1626,11 +1626,8 @@ void MainWidget::showSection( // return; } - using MementoPtr = std::unique_ptr; - const auto sharedMemento = std::make_shared( - std::move(memento)); if (preventsCloseSection( - [=] { showSection(base::take(*sharedMemento), params); }, + [=] { showSection(memento, params); }, params)) { return; } @@ -1640,9 +1637,7 @@ void MainWidget::showSection( // we need to update adaptive layout to Adaptive::ThirdColumn(). updateColumnLayout(); - showNewSection( - std::move(*sharedMemento), - params); + showNewSection(std::move(memento), params); } void MainWidget::updateColumnLayout() { @@ -1737,7 +1732,7 @@ Window::SectionSlideParams MainWidget::prepareDialogsAnimation() { } void MainWidget::showNewSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms) { using Column = Window::Column; @@ -2451,15 +2446,15 @@ bool MainWidget::saveThirdSectionToStackBack() const { auto MainWidget::thirdSectionForCurrentMainSection( Dialogs::Key key) --> std::unique_ptr { +-> std::shared_ptr { if (_thirdSectionFromStack) { return std::move(_thirdSectionFromStack); } else if (const auto peer = key.peer()) { - return std::make_unique( + return std::make_shared( peer, Info::Memento::DefaultSection(peer)); //} else if (const auto feed = key.feed()) { // #feed - // return std::make_unique( + // return std::make_shared( // feed, // Info::Memento::DefaultSection(key)); } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 586157c83..79b25a047 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -134,7 +134,7 @@ public: int backgroundFromY() const; void showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms); void updateColumnLayout(); bool stackIsEmpty() const; @@ -256,7 +256,7 @@ private: bool canWrite); [[nodiscard]] bool saveThirdSectionToStackBack() const; [[nodiscard]] auto thirdSectionForCurrentMainSection(Dialogs::Key key) - -> std::unique_ptr; + -> std::shared_ptr; void setupConnectingWidget(); void createPlayer(); @@ -276,7 +276,7 @@ private: Window::SectionSlideParams prepareShowAnimation( bool willHaveTopBarShadow); void showNewSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms); void dropMainSection(Window::SectionWidget *widget); @@ -353,7 +353,7 @@ private: object_ptr _history; object_ptr _mainSection = { nullptr }; object_ptr _thirdSection = { nullptr }; - std::unique_ptr _thirdSectionFromStack; + std::shared_ptr _thirdSectionFromStack; std::unique_ptr _connecting; base::weak_ptr _currentCall; diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 00f822f8e..02d26f9b8 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -650,7 +650,7 @@ void Manager::openNotificationMessage( Ui::showPeerHistory(history, messageId); //} else if (messageFeed) { // #feed // App::wnd()->sessionController()->showSection( - // std::make_unique(messageFeed)); + // std::make_shared(messageFeed)); } else { Ui::showPeerHistory(history, ShowAtUnreadMsgId); } diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index 5a7119ae6..1e4fa8702 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -70,7 +70,7 @@ void SectionWidget::showAnimated( show(); } -std::unique_ptr SectionWidget::createMemento() { +std::shared_ptr SectionWidget::createMemento() { return nullptr; } diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 472d5e2b4..4ee0db362 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -135,7 +135,7 @@ public: // Create a memento of that section to store it in the history stack. // This method may modify the section ("take" heavy items). - virtual std::unique_ptr createMemento(); + virtual std::shared_ptr createMemento(); void setInnerFocus() { doSetInnerFocus(); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 1efe6f16d..3e8a06744 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -714,7 +714,7 @@ void Filler::addTogglesForArchive() { // const auto controller = _controller; // const auto feed = _feed; // _addAction(tr::lng_context_view_feed_info(tr::now), [=] { -// controller->showSection(std::make_unique( +// controller->showSection(std::make_shared( // feed, // Info::Section(Info::Section::Type::Profile))); // }); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index b6e13be53..a4063bd14 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -253,12 +253,12 @@ void SessionNavigation::showRepliesForMessage( const auto channelId = history->channelId(); //const auto item = _session->data().message(channelId, rootId); //if (!commentId && (!item || !item->repliesAreComments())) { - // showSection(std::make_unique(history, rootId)); + // showSection(std::make_shared(history, rootId)); // return; //} else if (const auto id = item ? item->commentsItemId() : FullMsgId()) { // if (const auto commentsItem = _session->data().message(id)) { // showSection( - // std::make_unique(commentsItem)); + // std::make_shared(commentsItem)); // return; // } //} @@ -314,7 +314,7 @@ void SessionNavigation::showRepliesForMessage( post->setRepliesOutboxReadTill(readTill->v); } } - showSection(std::make_unique( + showSection(std::make_shared( item, commentId)); } @@ -342,7 +342,7 @@ void SessionNavigation::showPeerInfo( // Core::App().settings().setThirdSectionInfoEnabled(true); // Core::App().saveSettingsDelayed(); //} - showSection(std::make_unique(peer), params); + showSection(std::make_shared(peer), params); } void SessionNavigation::showPeerInfo( @@ -375,7 +375,7 @@ void SessionNavigation::showSettings( Settings::Type type, const SectionShow ¶ms) { showSection( - std::make_unique( + std::make_shared( Info::Settings::Tag{ _session->user() }, Info::Section(type)), params); @@ -389,7 +389,7 @@ void SessionNavigation::showPollResults( not_null poll, FullMsgId contextId, const SectionShow ¶ms) { - showSection(std::make_unique(poll, contextId), params); + showSection(std::make_shared(poll, contextId), params); } SessionController::SessionController( @@ -640,9 +640,9 @@ bool SessionController::jumpToChatListEntry(Dialogs::RowDescriptor row) { return true; //} else if (const auto feed = row.key.feed()) { // #feed // if (const auto item = session().data().message(row.fullId)) { - // showSection(std::make_unique(feed, item->position())); + // showSection(std::make_shared(feed, item->position())); // } else { - // showSection(std::make_unique(feed)); + // showSection(std::make_shared(feed)); // } } return false; @@ -1087,7 +1087,7 @@ void SessionController::showPeerHistory( } void SessionController::showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms) { if (!params.thirdColumn && widget()->showSectionInExistingLayer( memento.get(), diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 88f563031..64f3b8b66 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -132,7 +132,7 @@ public: Main::Session &session() const; virtual void showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms = SectionShow()) = 0; virtual void showBackFromStack( const SectionShow ¶ms = SectionShow()) = 0; @@ -301,7 +301,7 @@ public: bool confirmedLeaveOther = false); void showSection( - std::unique_ptr &&memento, + std::shared_ptr memento, const SectionShow ¶ms = SectionShow()) override; void showBackFromStack( const SectionShow ¶ms = SectionShow()) override; diff --git a/Telegram/lib_base b/Telegram/lib_base index f98f02214..b95d2b4b3 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit f98f0221416746f0beaf5a51e95674a90442c3d5 +Subproject commit b95d2b4b378092daf3acb493515ff41a8e21f003 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index a02c8923d..e08a0de35 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit a02c8923dc6d00bcb4f4c2b1470cd48e2743903a +Subproject commit e08a0de35dd2d0bbf26d88d127ac7b80efb94150 diff --git a/cmake b/cmake index 1c2be0df2..ceb580893 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 1c2be0df28feb0c4629a1f37ccf7d23da2ff17c1 +Subproject commit ceb5808939cf770c33be996ab3a1d38a998bf16d