From ee773a28bb62b93fcf56763a366f689977087a0c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 7 Jul 2021 16:32:39 +0400 Subject: [PATCH] Fix 30s freeze after pasting --- .../platform/linux/linux_gtk_integration.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp b/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp index 3faec9248..451408c39 100644 --- a/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_gtk_integration.cpp @@ -499,15 +499,26 @@ QImage GtkIntegration::getImageFromClipboard() const { try { Glib::RefPtr outFdList; - auto reply = _private->dbusConnection->call_sync( + const auto loop = Glib::MainLoop::create(); + Glib::VariantContainerBase reply; + _private->dbusConnection->call( std::string(kObjectPath), std::string(kInterface), "GetImageFromClipboard", {}, - {}, - outFdList, + [&](const Glib::RefPtr &result) { + try { + reply = _private->dbusConnection->call_finish( + result, + outFdList); + } catch (...) { + } + loop->quit(); + }, ServiceName); + loop->run(); + const auto streamSize = base::Platform::GlibVariantCast( reply.get_child(1));