Browse Source

do not try to create a Data object by UnsafeBufferPointer that point to already unref'd data

B. Petersen 3 years ago
parent
commit
45d67a4b73
1 changed files with 2 additions and 1 deletions
  1. 2 1
      DcCore/DcCore/DC/Wrapper.swift

+ 2 - 1
DcCore/DcCore/DC/Wrapper.swift

@@ -1113,8 +1113,9 @@ public class DcMsg {
 
         let count = ptrSize.pointee
         let buffer = UnsafeBufferPointer<Int8>(start: ccharPtr, count: count)
+        let data = Data(buffer: buffer)
         dc_str_unref(ccharPtr)
-        return Data(buffer: buffer)
+        return data
     }
 
     public func getWebxdcInfoJson() -> String {