Skip to content

Commit

Permalink
first try
Browse files Browse the repository at this point in the history
just took it from issues page
hdbc#48 (comment)
  • Loading branch information
supersonic-copycat committed Nov 16, 2024
1 parent 0e492c8 commit 5ad9362
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Database/HDBC/ODBC/Wrappers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sqlAllocEnv = do
handleVar <- newMVar (Just hEnv)
let wrapper = EnvWrapper handleVar

addFinalizer wrapper $ freeEnvIfNotAlready wrapper
_ <- mkWeakMVar handleVar $ freeEnvIfNotAlready wrapper
return wrapper

freeEnvIfNotAlready :: EnvWrapper -> IO ()
Expand Down Expand Up @@ -98,7 +98,7 @@ sqlAllocDbc env = do
oldStmtsVar <- newMVar []
let wrapper = DbcWrapper handleVar env oldStmtsVar

addFinalizer wrapper $ freeDbcIfNotAlready False wrapper
_ <- mkWeakMVar oldStmtsVar (freeDbcIfNotAlready False wrapper)
return wrapper

freeOldStmts :: DbcWrapper -> IO ()
Expand Down Expand Up @@ -163,7 +163,7 @@ sqlAllocStmt dbc = do
handleVar <- newMVar $ Just hStmt
let wrapper = StmtWrapper handleVar dbc

addFinalizer wrapper $ freeStmtIfNotAlready wrapper
mkWeakMVar handleVar $ freeStmtIfNotAlready wrapper
return wrapper

freeStmtIfNotAlready :: StmtWrapper -> IO ()
Expand Down

0 comments on commit 5ad9362

Please sign in to comment.