mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Fix an infinite recursion in Emoji panel/section.
HistoryWidget::resizeEvent() can start taking TabbedSelector from TabbedPanel which will call QWidget::render() which can call again HistoryWidget::resizeEvent() from sendPendingMoveAndResizeEvents(). Use a separate flag for _tabbedSection to prevent recursion there.
This commit is contained in:
@@ -3699,13 +3699,17 @@ void HistoryWidget::topBarClick() {
|
||||
|
||||
void HistoryWidget::updateTabbedSelectorSectionShown() {
|
||||
auto tabbedSelectorSectionEnabled = AuthSession::Current().data().tabbedSelectorSectionEnabled();
|
||||
auto shown = tabbedSelectorSectionEnabled && (width() >= minimalWidthForTabbedSelectorSection());
|
||||
auto shownNow = (_tabbedSection != nullptr);
|
||||
if (shown == shownNow) {
|
||||
auto useTabbedSection = tabbedSelectorSectionEnabled && (width() >= minimalWidthForTabbedSelectorSection());
|
||||
if (_tabbedSectionUsed == useTabbedSection) {
|
||||
return;
|
||||
}
|
||||
_tabbedSectionUsed = useTabbedSection;
|
||||
|
||||
if (shown) {
|
||||
// Use a separate bool flag instead of just (_tabbedSection != nullptr), because
|
||||
// _tabbedPanel->takeSelector() calls QWidget::render(), which calls
|
||||
// sendPendingMoveAndResizeEvents() for all widgets in the window, which can lead
|
||||
// to a new HistoryWidget::resizeEvent() call and an infinite recursion here.
|
||||
if (_tabbedSectionUsed) {
|
||||
_tabbedSection.create(this, _controller, _tabbedPanel->takeSelector());
|
||||
_tabbedSection->setCancelledCallback([this] { setInnerFocus(); });
|
||||
_rightShadow.create(this, st::shadowFg);
|
||||
|
Reference in New Issue
Block a user