FIX actually the dbus client disconnect problem

This commit is contained in:
Nathan Dwarshuis 2023-10-28 00:14:40 -04:00
parent 841bf0b5c8
commit d9b1886db6
1 changed files with 7 additions and 4 deletions

View File

@ -110,9 +110,7 @@ withDBusClientConnection cb n logfile f =
logOpts <- setLogVerboseFormat True . setLogUseTime True <$> logOptionsHandle h False
withLogFunc logOpts $ \lf -> do
env <- mkSimpleApp lf Nothing
runRIO env $
bracket (getDBusClient n) (mapM (liftIO . disconnect . ncClient)) $
displayMaybe' cb f
runRIO env $ displayMaybe' cb f =<< getDBusClient n
-- | Run a plugin action with a new DBus client and logfile path.
-- This is necessary for DBus callbacks which run in separate threads, which
@ -128,4 +126,9 @@ withNestedDBusClientConnection n logfile f = do
dpy <- asks plugDisplay
s <- asks plugState
cb <- asks plugCallback
withDBusClientConnection cb n logfile $ \c -> mapRIO (PluginEnv c s dpy cb) f
let run h = do
logOpts <- setLogVerboseFormat True . setLogUseTime True <$> logOptionsHandle h False
withLogFunc logOpts $ \lf -> do
env <- mkSimpleApp lf Nothing
runRIO env $ withDBusClient_ n $ \cl -> mapRIO (PluginEnv cl s dpy cb) f
maybe (run stderr) (`withLogFile` run) logfile