From 794aba38bac729471afbcc3aca62400bafd55b4c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 5 Jul 2021 07:21:50 +0400 Subject: [PATCH] Use Glib::TimeoutSource instead of crl::async with usleep --- webview/platform/linux/webview_linux_webkit2gtk.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webview/platform/linux/webview_linux_webkit2gtk.cpp b/webview/platform/linux/webview_linux_webkit2gtk.cpp index 35e173d..098d3f8 100644 --- a/webview/platform/linux/webview_linux_webkit2gtk.cpp +++ b/webview/platform/linux/webview_linux_webkit2gtk.cpp @@ -21,7 +21,6 @@ #include #include #include -#include namespace Webview::WebKit2Gtk { namespace { @@ -777,13 +776,14 @@ void Instance::runProcess() { } // timeout in case something goes wrong - crl::async([=] { - usleep(5 * 1000 * 1000); - if (!loop->is_running()) { - return; + const auto timeout = Glib::TimeoutSource::create(5000); + timeout->connect([=] { + if (loop->is_running()) { + loop->quit(); } - loop->quit(); + return false; }); + timeout->attach(context); QProcess::startDetached( base::Integration::Instance().executablePath(),