Skip to content

Commit

Permalink
Use Glib::TimeoutSource instead of crl::async with usleep
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin authored and john-preston committed Jul 5, 2021
1 parent cc47e4e commit 794aba3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions webview/platform/linux/webview_linux_webkit2gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QProcess>
#include <giomm.h>
#include <crl/crl_async.h>

namespace Webview::WebKit2Gtk {
namespace {
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 794aba3

Please sign in to comment.