From 09163271d612a70b24fabbe7fbfeed7750c70a18 Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Wed, 4 May 2022 03:22:38 +0200 Subject: [PATCH] Catch errors in update_value to release lock If an error happens in update_value, reg.lock is never released, thus resulting in a deadlock. --- init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d8a293a..ebfdb32 100644 --- a/init.lua +++ b/init.lua @@ -11,6 +11,7 @@ -- Copyright (C) 2017 mutlusun -- Copyright (C) 2018 Beniamin Kalinowski -- Copyright (C) 2018,2020 Nguyễn Gia Phong +-- Copyright (C) 2022 Constantin Piber -- -- This file is part of Vicious. -- @@ -38,6 +39,14 @@ local table = { remove = table.remove } local helpers = require("vicious.helpers") +local dstatus, debug = pcall(require, "gears.debug") +local stderr = io.stderr +local warn +if dstatus then + warn = debug.print_warning +else + warn = function (msg) stderr:write("Warning (vicious): ", msg, "\n") end +end -- Vicious: widgets for the awesome window manager local vicious = {} @@ -132,7 +141,8 @@ local function update(widget, reg, disablecache) reg.warg, function(data) update_cache(data, update_time, c) - update_value(data) + local status, res = pcall(update_value, data) + if not status then warn(res) end reg.lock=false end) end