fix crash after drop in v10

After cleaning up the lock file, the content directory is gone, so
freezing it failed.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-01-20 14:00:19 -04:00
parent d0a5714409
commit 76e365769e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -243,8 +243,8 @@ lockContentUsing contentlocker key fallback a = withContentLockFile key $ \mlock
cleanuplockfile lockfile cleanuplockfile lockfile
liftIO $ dropLock h liftIO $ dropLock h
-- We have an exclusive lock, so no other process can have -- We have an exclusive lock, so no other process can have
-- the file locked, and so it's safe to remove it, as long -- the lock file locked, and so it's safe to remove it, as
-- as all attempts to lock the file use checkSaneLock. -- long as all lock attempts use checkSaneLock.
_ -> do _ -> do
maybe noop cleanuplockfile mlockfile maybe noop cleanuplockfile mlockfile
liftIO $ dropLock lck liftIO $ dropLock lck
@ -258,10 +258,10 @@ lockContentUsing contentlocker key fallback a = withContentLockFile key $ \mlock
maybe noop cleanuplockfile mlockfile maybe noop cleanuplockfile mlockfile
#endif #endif
cleanuplockfile lockfile = modifyContent lockfile $ cleanuplockfile lockfile = void $ tryNonAsync $ do
void $ liftIO $ tryIO $ do thawContentDir lockfile
removeWhenExistsWith R.removeLink lockfile liftIO $ removeWhenExistsWith R.removeLink lockfile
cleanObjectDirs lockfile liftIO $ cleanObjectDirs lockfile
{- Runs an action, passing it the temp file to get, {- Runs an action, passing it the temp file to get,
- and if the action succeeds, verifies the file matches - and if the action succeeds, verifies the file matches