From 7d3e9e8648c02a0892e9877819d56d7bc0e52ba7 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 19 Mar 2009 16:59:19 +0000 Subject: [PATCH] Stopped MTRelease being called with a NULL pointer --- backends/GenerateC.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 49b9bd7..df11e4d 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -1299,7 +1299,13 @@ cdeclareInit _ _ _ = Nothing -- | Free a declared item that's going out of scope. cdeclareFree :: Meta -> A.Type -> A.Variable -> Maybe (CGen ()) -cdeclareFree _ _ _ = Nothing -- TODO free mobiles that are going out of scope +cdeclareFree _ (A.Mobile {}) v = Just $ + do tell ["if ("] + call genVariable v + tell ["!=NULL){MTRelease(wptr,(void*)"] + call genVariable v + tell [");}"] +cdeclareFree _ _ _ = Nothing {- Original Abbrev