@@ -27,6 +27,9 @@ foreign import ccall unsafe "vty_activate_custom_table"
27foreign import ccall unsafe "vty_custom_table_ready"
27foreign import ccall unsafe "vty_custom_table_ready"
28 c_isCustomTableReady :: IO Int
28 c_isCustomTableReady :: IO Int
30+foreign import ccall unsafe "vty_deallocate_custom_table"
31+ deallocateCustomTable :: IO ()
30-- | Returns True if and only if a custom table has been allocated and
33-- | Returns True if and only if a custom table has been allocated and
31-- marked as ready for use. Returns False otherwise.
34-- marked as ready for use. Returns False otherwise.
32isCustomTableReady :: IO Bool
35isCustomTableReady :: IO Bool
@@ -80,7 +83,8 @@ installUnicodeWidthTable table = do
80 (rangeSize r)
83 (rangeSize r)
81 (rangeColumns r)
84 (rangeColumns r)
83− when (result /= 0) $
86+ when (result /= 0) $ do
87+ deallocateCustomTable
84 error $ "installUnicodeWidthTable: error installing range " <>
88 error $ "installUnicodeWidthTable: error installing range " <>
85 show r <> ", status " <> show result
89 show r <> ", status " <> show result