mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-19 18:05:37 +00:00
Fix touchbar destruction with Window.
This commit is contained in:
parent
a8d0b80baa
commit
eff340deaf
Telegram/SourceFiles/platform/mac
@ -454,6 +454,7 @@ void AppendEmojiPacks(
|
||||
|
||||
@interface PinnedDialogsPanel : NSImageView
|
||||
- (id)init:(not_null<Main::Session*>)session;
|
||||
- (void)dealloc;
|
||||
@end // @interface PinnedDialogsPanel
|
||||
|
||||
@implementation PinnedDialogsPanel {
|
||||
@ -770,6 +771,9 @@ void AppendEmojiPacks(
|
||||
|
||||
const auto updatePanelSize = [=] {
|
||||
const auto size = lastDialogsCount->current();
|
||||
if (self.image) {
|
||||
[self.image release];
|
||||
}
|
||||
self.image = [[NSImage alloc] initWithSize:NSMakeSize(
|
||||
size * (kCircleDiameter + kPinnedButtonsSpace)
|
||||
+ kPinnedButtonsLeftSkip
|
||||
@ -990,6 +994,13 @@ void AppendEmojiPacks(
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.image) {
|
||||
[self.image release];
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (int)shift {
|
||||
return (_hasArchive ? 1 : 0) + (_selfUnpinned ? 1 : 0);
|
||||
}
|
||||
@ -1890,6 +1901,8 @@ void AppendEmojiPacks(
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_touchBarMain release];
|
||||
[_touchBarAudioPlayer release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
void hideAndDeactivate();
|
||||
void updateTitleCounter();
|
||||
void updateIconCounters();
|
||||
void destroyCurrentTouchBar();
|
||||
|
||||
std::unique_ptr<Private> _private;
|
||||
|
||||
|
@ -491,14 +491,6 @@ void MainWindow::initTouchBar() {
|
||||
}
|
||||
};
|
||||
|
||||
const auto destroyCurrentTouchBar = [=] {
|
||||
if (_private->_touchBar) {
|
||||
[_private->_touchBar setTouchBar:Platform::TouchBarType::None];
|
||||
[_private->_touchBar release];
|
||||
}
|
||||
_private->_touchBar = nil;
|
||||
};
|
||||
|
||||
Core::App().domain().activeSessionChanges(
|
||||
) | rpl::start_with_next([=](Main::Session *session) {
|
||||
if (session) {
|
||||
@ -512,6 +504,14 @@ void MainWindow::initTouchBar() {
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void MainWindow::destroyCurrentTouchBar() {
|
||||
if (_private->_touchBar) {
|
||||
[_private->_touchBar setTouchBar:Platform::TouchBarType::None];
|
||||
[_private->_touchBar release];
|
||||
}
|
||||
_private->_touchBar = nil;
|
||||
}
|
||||
|
||||
void MainWindow::closeWithoutDestroy() {
|
||||
NSWindow *nsWindow = [reinterpret_cast<NSView*>(winId()) window];
|
||||
|
||||
@ -875,6 +875,7 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *evt) {
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
destroyCurrentTouchBar();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user