gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-iono] branch master updated: fix deallocation of iono


From: gnunet
Subject: [taler-iono] branch master updated: fix deallocation of iono
Date: Tue, 19 Jul 2022 06:49:30 +0200

This is an automated email from the git hooks/post-receive script.

jonathan-buchanan pushed a commit to branch master
in repository iono.

The following commit(s) were added to refs/heads/master by this push:
     new 2a43b45  fix deallocation of iono
2a43b45 is described below

commit 2a43b45c68ddb5a798d7deeeb3fd879304002db6
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Tue Jul 19 00:49:12 2022 -0400

    fix deallocation of iono
---
 iono.xcodeproj/project.pbxproj | 22 ++++++++++++++++++++++
 iono/iono.cpp                  |  8 +++++++-
 iono/iono.swift                |  9 +++++----
 ios-node-v8                    |  2 +-
 4 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/iono.xcodeproj/project.pbxproj b/iono.xcodeproj/project.pbxproj
index f4d27b6..3ad2185 100644
--- a/iono.xcodeproj/project.pbxproj
+++ b/iono.xcodeproj/project.pbxproj
@@ -24,6 +24,8 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               AB27489328812D5400EA581D /* libbrotli.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libbrotli.a; path = 
"ios-node-v8/out-arm64/Debug/libbrotli.a"; sourceTree = "<group>"; };
+               AB27489528812D7A00EA581D /* libbrotli.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libbrotli.a; path = 
"ios-node-v8/out-x64/Debug/libbrotli.a"; sourceTree = "<group>"; };
                D117861F268A4D8D00B63B20 /* libiono.a */ = {isa = 
PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = 
libiono.a; sourceTree = BUILT_PRODUCTS_DIR; };
                D1178622268A4D8D00B63B20 /* iono.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = iono.swift; 
sourceTree = "<group>"; };
                D1178629268A4E6900B63B20 /* iono-Bridging-Header.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
"iono-Bridging-Header.h"; sourceTree = "<group>"; };
@@ -42,11 +44,21 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+               AB27489228812D5400EA581D /* Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               AB27489528812D7A00EA581D /* libbrotli.a */,
+                               AB27489328812D5400EA581D /* libbrotli.a */,
+                       );
+                       name = Frameworks;
+                       sourceTree = "<group>";
+               };
                D1178616268A4D8D00B63B20 = {
                        isa = PBXGroup;
                        children = (
                                D1178621268A4D8D00B63B20 /* iono */,
                                D1178620268A4D8D00B63B20 /* Products */,
+                               AB27489228812D5400EA581D /* Frameworks */,
                        );
                        sourceTree = "<group>";
                };
@@ -279,6 +291,11 @@
                                        "@executable_path/Frameworks",
                                        "@loader_path/Frameworks",
                                );
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       
"$(PROJECT_DIR)/ios-node-v8/out-arm64/Debug",
+                                       
"$(PROJECT_DIR)/ios-node-v8/out-x64/Debug",
+                               );
                                OTHER_LDFLAGS = "-ObjC";
                                PRODUCT_NAME = "$(TARGET_NAME)";
                                SKIP_INSTALL = YES;
@@ -299,6 +316,11 @@
                                        "@executable_path/Frameworks",
                                        "@loader_path/Frameworks",
                                );
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       
"$(PROJECT_DIR)/ios-node-v8/out-arm64/Debug",
+                                       
"$(PROJECT_DIR)/ios-node-v8/out-x64/Debug",
+                               );
                                OTHER_LDFLAGS = "-ObjC";
                                PRODUCT_NAME = "$(TARGET_NAME)";
                                SKIP_INSTALL = YES;
diff --git a/iono/iono.cpp b/iono/iono.cpp
index 9a7d6e4..418f66b 100644
--- a/iono/iono.cpp
+++ b/iono/iono.cpp
@@ -32,8 +32,8 @@ std::map<std::string, std::string> modmap = 
std::map<std::string, std::string>()
 struct __IonoInstance
 {
     /* Node/V8 */
-    static std::unique_ptr<node::MultiIsolatePlatform> platform;
     std::unique_ptr<node::CommonEnvironmentSetup> setup;
+    static std::unique_ptr<node::MultiIsolatePlatform> platform;
     v8::Isolate *isolate;
     node::Environment *env;
     uv_loop_t *event_loop;
@@ -46,6 +46,8 @@ struct __IonoInstance
     void *notification_userdata;
 
     __IonoInstance();
+    
+    ~__IonoInstance();
 
     char *
     evalJs(const char *js);
@@ -205,6 +207,10 @@ __IonoInstance::__IonoInstance() :
     }
 }
 
+__IonoInstance::~__IonoInstance() {
+    uv_close(reinterpret_cast<uv_handle_t *>(&async_notify), nullptr);
+}
+
 char *
 __IonoInstance::evalJs(const char *js)
 {
diff --git a/iono/iono.swift b/iono/iono.swift
index 1f07140..95feb5b 100644
--- a/iono/iono.swift
+++ b/iono/iono.swift
@@ -16,7 +16,7 @@
 
 import Foundation
 
-public protocol IonoMessageHandler {
+public protocol IonoMessageHandler: AnyObject {
     func handleMessage(message: String)
 }
 
@@ -48,7 +48,7 @@ struct Queue<T> {
 }
 
 class NodeThread: Thread {
-    var iono: Iono!
+    weak var iono: Iono!
     var workQueue: Queue<() -> ()>
     var initialized: Bool
     var initCondition: NSCondition
@@ -98,9 +98,9 @@ public class Iono {
     var thread: NodeThread
 
     var instance: OpaquePointer!
-    public var messageHandler: IonoMessageHandler?
+    public weak var messageHandler: IonoMessageHandler?
 
-    public init() { // We need to be calling runNode!
+    public init() {
         self.stopped = false
         self.thread = NodeThread()
         self.thread.iono = self
@@ -179,6 +179,7 @@ public class Iono {
         evalNodeCode(source: source)
     }
 
+    /// Note: This *must* be called before releasing the object, or else the 
thread will keep going.
     public func waitStopped() {
         scheduleNodeThreadSync {
             self.stopped = true
diff --git a/ios-node-v8 b/ios-node-v8
index b9509b4..aaa00a7 160000
--- a/ios-node-v8
+++ b/ios-node-v8
@@ -1 +1 @@
-Subproject commit b9509b499c9822229cdd6bda81b2c1e453259ec8
+Subproject commit aaa00a74c8cd2afdd8205f6f0beecd1f94caafee

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]