fix: app restart & crashes on macOS

This commit is contained in:
AlexeyZavar
2026-03-02 17:56:38 +03:00
parent 4ea9355f5f
commit dfc6718bea
5 changed files with 19 additions and 10 deletions
@@ -92,6 +92,9 @@ void BuildAppIcon(SectionBuilder &builder, AyuSectionBuilder &ayu) {
builder.addSkip();
builder.addDividerText(tr::ayu_HideNotificationBadgeDescription());
builder.addSkip();
#else
builder.addDivider();
builder.addSkip();
#endif
}
@@ -977,12 +977,12 @@ static bool prependPseudoReplyImpl(
shiftEntities(textWithTags.tags, prefixLength);
EntitiesInText newEntities;
const auto nameLength = name.length();
const auto nameLength = int(name.length());
newEntities.push_back(EntityInText{
EntityType::Blockquote,
0,
prefix.length(),
int(prefix.length()),
{}
});
@@ -65,6 +65,9 @@ QImage PrepareFrame(
if (hasAlpha && request.keepAlpha) {
cache.fill(Qt::transparent);
}
if (!QCoreApplication::instance()) { // fix crash on macOS on exit
return cache;
}
{
auto p = QPainter(&cache);
const auto framew = request.frame.width();
@@ -33,15 +33,18 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
}
@autoreleasepool {
#ifdef OS_MAC_STORE
// In AppStore version we don't have Updater.
// We just relaunch our app.
if (action == UpdaterLaunch::JustRelaunch) {
NSDictionary *conf = [NSDictionary dictionaryWithObject:[NSArray array] forKey:NSWorkspaceLaunchConfigurationArguments];
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:Q2NSString(cExeDir() + cExeName())] options:NSWorkspaceLaunchAsync | NSWorkspaceLaunchNewInstance configuration:conf error:0];
return true;
#ifdef OS_MAC_STORE
const auto updaterDisabled = true;
#else
const auto updaterDisabled = Core::UpdaterDisabled();
#endif
if (updaterDisabled) {
NSDictionary *conf = [NSDictionary dictionaryWithObject:[NSArray array] forKey:NSWorkspaceLaunchConfigurationArguments];
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:Q2NSString(cExeDir() + cExeName())] options:NSWorkspaceLaunchAsync | NSWorkspaceLaunchNewInstance configuration:conf error:0];
return true;
}
}
#endif // OS_MAC_STORE
NSString *path = @"", *args = @"";
@try {