@@ -27,6 +27,9 @@ foreign import ccall unsafe "vty_activate_custom_table"
2727foreign import ccall unsafe "vty_custom_table_ready"
2828 c_isCustomTableReady :: IO Int
2929
30+foreign import ccall unsafe "vty_deallocate_custom_table"
31+ deallocateCustomTable :: IO ()
32+
3033-- | Returns True if and only if a custom table has been allocated and
3134-- marked as ready for use. Returns False otherwise.
3235isCustomTableReady :: IO Bool
@@ -80,7 +83,8 @@ installUnicodeWidthTable table = do
8083 (rangeSize r)
8184 (rangeColumns r)
8285
83− when (result /= 0) $
86+ when (result /= 0) $ do
87+ deallocateCustomTable
8488 error $ "installUnicodeWidthTable: error installing range " <>
8589 show r <> ", status " <> show result
8690