Hipmunk 5.2.0.5 → 5.2.0.6
raw patch · 3 files changed
+17/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Hipmunk.cabal +6/−2
- NEWS +4/−0
- Physics/Hipmunk/Callbacks.hsc +7/−7
Hipmunk.cabal view
@@ -3,7 +3,7 @@ Tested-With: GHC Category: Physics, Game Name: Hipmunk-Version: 5.2.0.5+Version: 5.2.0.6 Stability: provisional License: OtherLicense License-File: LICENSE@@ -20,10 +20,14 @@ Please see <http://hackage.haskell.org/package/HipmunkPlayground> for a demonstration of this library. .+ New in version 5.2.0.6:+ .+ * Fixed a memory leak related to collision handlers.+ . New in version 5.2.0.5: . * Always compile @wrapper.c@ and fix Haddock errors- while handling Unicode. Thanks, Joachim Breitner.+ while handling Unicode. Thanks, Joachim Breitner. . New in version 5.2.0.4: .
NEWS view
@@ -1,3 +1,7 @@+Version 5.2.0.6+===============+ - Fixed a memory leak related to collision handlers.+ Version 5.2.0.5 =============== - Always compile @wrapper.c@ and fix Haddock errors
Physics/Hipmunk/Callbacks.hsc view
@@ -498,15 +498,15 @@ let handlerAdder p = cpSpaceAddCollisionHandler p cta ctb ptrs <- addHandler spce handlerAdder handler - -- Free the previous one and record the new one, using- -- updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k- -- -> Map k a -> (Maybe a, Map k a)+ -- Free the previous one and record the new one. cbs <- readIORef callbacks let handlers = cbsHandlers cbs- val = case handler of- Handler Nothing Nothing Nothing Nothing -> Nothing- _ -> Just ptrs- (old,handlers') = M.updateLookupWithKey (\_ _ -> val) (cta,ctb) handlers+ old = M.lookup (cta,ctb) handlers+ handlers' =+ if ptrs == (nullFunPtr, nullFunPtr, nullFunPtr, nullFunPtr)+ -- no need to gc nullFunPtrs+ then handlers+ else M.insert (cta,ctb) ptrs handlers maybe (return ()) freeHandlerFunPtrs old writeIORef callbacks $ cbs {cbsHandlers = handlers'}