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).
This commit is contained in:
John Preston 2017-02-28 11:14:12 +03:00
parent a5eb5a6ea2
commit ae08a2f697
7 changed files with 43 additions and 32 deletions

View File

@ -9,7 +9,7 @@
<Identity Name="TelegramDesktop"
ProcessorArchitecture="x64"
Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB"
Version="1.0.16.0" />
Version="1.0.17.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -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 <Shobjidl.h>
#include <shellapi.h>
@ -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);
});
}

View File

@ -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

View File

@ -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.