Replace crl::on_main to InvokeQueued in some cases.

If the event loop is reentered from the call it is unsafe to crl::on_main.
For example NSOpenPanel lags terribly if it is shown from crl::on_main.
This commit is contained in:
John Preston 2018-02-07 17:18:59 +03:00
parent a2a5c30e60
commit 5a5c5782a9
1 changed files with 5 additions and 5 deletions

View File

@ -92,7 +92,7 @@ void OpenEmailLink(const QString &email) {
}
void OpenWith(const QString &filepath, QPoint menuPosition) {
crl::on_main([=] {
InvokeQueued(QApplication::instance(), [=] {
if (!Platform::File::UnsafeShowOpenWithDropdown(filepath, menuPosition)) {
if (!Platform::File::UnsafeShowOpenWith(filepath)) {
Platform::File::UnsafeLaunch(filepath);
@ -134,7 +134,7 @@ void GetOpenPath(
const QString &filter,
base::lambda<void(OpenResult &&result)> callback,
base::lambda<void()> failed) {
crl::on_main([=] {
InvokeQueued(QApplication::instance(), [=] {
auto files = QStringList();
auto remoteContent = QByteArray();
const auto success = Platform::FileDialog::Get(
@ -165,7 +165,7 @@ void GetOpenPaths(
const QString &filter,
base::lambda<void(OpenResult &&result)> callback,
base::lambda<void()> failed) {
crl::on_main([=] {
InvokeQueued(QApplication::instance(), [=] {
auto files = QStringList();
auto remoteContent = QByteArray();
const auto success = Platform::FileDialog::Get(
@ -193,7 +193,7 @@ void GetWritePath(
const QString &initialPath,
base::lambda<void(QString &&result)> callback,
base::lambda<void()> failed) {
crl::on_main([=] {
InvokeQueued(QApplication::instance(), [=] {
auto file = QString();
if (filedialogGetSaveFile(file, caption, filter, initialPath)) {
if (callback) {
@ -210,7 +210,7 @@ void GetFolder(
const QString &initialPath,
base::lambda<void(QString &&result)> callback,
base::lambda<void()> failed) {
crl::on_main([=] {
InvokeQueued(QApplication::instance(), [=] {
auto files = QStringList();
auto remoteContent = QByteArray();
const auto success = Platform::FileDialog::Get(