I'm able to prevent the crash by adding extra Retain/Release calls as shown
below, but am I just causing a memory leak?
Private Function BinaryPlistToDictionary(data as String) as Dictionary
#if TargetMacOS
LogTrace CurrentMethodName + " length=" + str(data.lenB)
if data = "" then
return nil
end if
dim cb as new CFBinaryDataMBS(data)
if cb = nil then
return nil
end if
cb.RetainObject
dim co as CFObjectMBS = NewCFObjectMBSFromXML(cb)
if co = nil then
return nil
end if
co.RetainObject
dim cd as CFDictionaryMBS = CFDictionaryMBS(co)
if cd = nil then
return nil
end if
cd.RetainObject
dim d as dictionary = cd.Dictionary
cd.ReleaseObject
co.ReleaseObject
cb.ReleaseObject
cd=nil
co=nil
cb=nil
return d
#endif
End Function
> On Jan 20, 2019, at 8:57 AM, Michael Diehr <[email protected]> wrote:
>
> Hi Christian,
>
> I'm seeing crashes in the following code:
>
> Private Function BinaryPlistToDictionary(data as String) as Dictionary
> #if TargetMacOS
>
> if data = "" then
> return nil
> end if
> dim cb as CFBinaryDataMBS = NewCFBinaryDataMBSStr(data)
> if cb = nil then
> return nil
> end if
>
> dim co as CFObjectMBS = NewCFObjectMBSFromXML(cb)
> if co = nil then
> return nil
> end if
>
>
> dim cd as CFDictionaryMBS = CFDictionaryMBS(co)
> if cd = nil then
> return nil
> end if
>
> dim d as dictionary = cd.Dictionary
> return d
> #endif
> End Function
>
> The crash log looks like this:
>
> Thread 15 Crashed:
> 0 com.apple.CoreFoundation 0x00007fff86ae4792 _CFRelease + 1346
> 1 MBS_MacCF_CF_Plugin_19832.dylib 0x000000010efcfb5d
> CFObjectDestructor(REALobjectStruct*) + 29
> 2 iScreensaver Designer 6.debug 0x000000010a204bf6
> CFObjectMBS.__exit%%o<CFObjectMBS> + 54
> 3 XojoFramework 0x000000010c6273af RuntimeUnlockObject
> + 815
> 4 iScreensaver Designer 6.debug 0x000000010b7aad87
> ciPhoto3.BinaryPlistToDictionary%o<Dictionary>%o<ciPhoto3>s + 1335
> (/ciPhoto3:11)
>
> Is this my fault, or is there perhaps a double-free going on?
> _______________________________________________
> Mbsplugins_monkeybreadsoftware.info mailing list
> [email protected]
> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
>
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info