From ae08a2f69781b9776a9e1943c07fb1b3b68138da Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 28 Feb 2017 11:14:12 +0300 Subject: [PATCH] Alpha 1.0.17: crash fix in file open. ShellExecute() call reenters Qt event loop, so each time we schedule a delayed action (like destroying FileLoader) and after that we call ShellExecute (in psOpenFile) we destroy it inside this call and can't use it after. So now we perform ShellExecute calls only delayed (using task queue). --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++-- Telegram/Resources/winrc/Updater.rc | 8 ++-- Telegram/SourceFiles/core/version.h | 4 +- Telegram/SourceFiles/pspecific_win.cpp | 39 +++++++++++--------- Telegram/build/version | 6 +-- changelog.txt | 8 ++++ 7 files changed, 43 insertions(+), 32 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index a0a6cf891d..30a22ad8a7 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="1.0.17.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 5aa0be04dc..ff58b7f936 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,16,0 - PRODUCTVERSION 1,0,16,0 + FILEVERSION 1,0,17,0 + PRODUCTVERSION 1,0,17,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -52,10 +52,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "1.0.16.0" + VALUE "FileVersion", "1.0.17.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.16.0" + VALUE "ProductVersion", "1.0.17.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 253d3d4a3d..38b2fc1c36 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,16,0 - PRODUCTVERSION 1,0,16,0 + FILEVERSION 1,0,17,0 + PRODUCTVERSION 1,0,17,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "1.0.16.0" + VALUE "FileVersion", "1.0.17.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.16.0" + VALUE "ProductVersion", "1.0.17.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 621cd46e0a..f4054277c6 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000016; -constexpr str_const AppVersionStr = "1.0.16"; +constexpr int AppVersion = 1000017; +constexpr str_const AppVersionStr = "1.0.17"; constexpr bool AppAlphaVersion = true; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp index 4e34d4466c..06066403c7 100644 --- a/Telegram/SourceFiles/pspecific_win.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -30,10 +30,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "mainwindow.h" #include "mainwidget.h" #include "history/history_location_manager.h" - #include "localstorage.h" - #include "passcodewidget.h" +#include "core/task_queue.h" #include #include @@ -702,28 +701,32 @@ bool psShowOpenWithMenu(int x, int y, const QString &file) { } void psOpenFile(const QString &name, bool openWith) { - bool mailtoScheme = name.startsWith(qstr("mailto:")); - std::wstring wname = mailtoScheme ? name.toStdWString() : QDir::toNativeSeparators(name).toStdWString(); + base::TaskQueue::Main().Put([name, openWith] { + bool mailtoScheme = name.startsWith(qstr("mailto:")); + std::wstring wname = mailtoScheme ? name.toStdWString() : QDir::toNativeSeparators(name).toStdWString(); - if (openWith && useOpenAs) { - if (Dlls::SHOpenWithDialog) { - OPENASINFO info; - info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT | OAIF_EXEC; - if (mailtoScheme) info.oaifInFlags |= OAIF_FILE_IS_URI | OAIF_URL_PROTOCOL; - info.pcszClass = NULL; - info.pcszFile = wname.c_str(); - Dlls::SHOpenWithDialog(0, &info); + if (openWith && useOpenAs) { + if (Dlls::SHOpenWithDialog) { + OPENASINFO info; + info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT | OAIF_EXEC; + if (mailtoScheme) info.oaifInFlags |= OAIF_FILE_IS_URI | OAIF_URL_PROTOCOL; + info.pcszClass = NULL; + info.pcszFile = wname.c_str(); + Dlls::SHOpenWithDialog(0, &info); + } else { + Dlls::OpenAs_RunDLL(0, 0, wname.c_str(), SW_SHOWNORMAL); + } } else { - Dlls::OpenAs_RunDLL(0, 0, wname.c_str(), SW_SHOWNORMAL); + ShellExecute(0, L"open", wname.c_str(), 0, 0, SW_SHOWNORMAL); } - } else { - ShellExecute(0, L"open", wname.c_str(), 0, 0, SW_SHOWNORMAL); - } + }); } void psShowInFolder(const QString &name) { - QString nameEscaped = QDir::toNativeSeparators(name).replace('"', qsl("\"\"")); - ShellExecute(0, 0, qsl("explorer").toStdWString().c_str(), (qsl("/select,") + nameEscaped).toStdWString().c_str(), 0, SW_SHOWNORMAL); + base::TaskQueue::Main().Put([name] { + auto nameEscaped = QDir::toNativeSeparators(name).replace('"', qsl("\"\"")); + ShellExecute(0, 0, qsl("explorer").toStdWString().c_str(), (qsl("/select,") + nameEscaped).toStdWString().c_str(), 0, SW_SHOWNORMAL); + }); } diff --git a/Telegram/build/version b/Telegram/build/version index c74cf0f10f..865b7fbfdc 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000016 +AppVersion 1000017 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.16 -AppVersionStr 1.0.16 +AppVersionStrSmall 1.0.17 +AppVersionStr 1.0.17 AlphaChannel 1 BetaVersion 0 diff --git a/changelog.txt b/changelog.txt index f0d8560860..b20b23cda1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,11 @@ +1.0.17 alpha (28.02.17) + +- Bug fixes and other minor improvements. + +1.0.16 alpha (27.02.17) + +- Bug fixes and other minor improvements. + 1.0.15 alpha (27.02.17) - Wrong supergroup members display fix.