blueloveTH há 3 anos atrás
pai
commit
ae3248d865

+ 1 - 1
plugins/flutter/CHANGELOG.md

@@ -1,4 +1,4 @@
-## 0.5.0+5
+## 0.5.0+6
 
 + Fix a bug of crash when using multi-thread
 

+ 1 - 1
plugins/flutter/pubspec.yaml

@@ -1,6 +1,6 @@
 name: pocketpy
 description: A lightweight Python interpreter for game engines.
-version: 0.5.0+5
+version: 0.5.0+6
 homepage: https://pocketpy.dev
 repository: https://github.com/blueloveth/pocketpy
 

+ 3 - 3
plugins/flutter/src/pocketpy.h

@@ -2307,7 +2307,7 @@ public:
 
 namespace pkpy {
     const uint8_t MAX_POOLING_N = 10;
-    static std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
+    static thread_local std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
 
     class ArgList {
         PyVar* _args = nullptr;
@@ -2428,7 +2428,7 @@ namespace pkpy {
     };
 
     const ArgList& noArg(){
-        static ArgList ret(0);
+        static const ArgList ret(0);
         return ret;
     }
 
@@ -3865,7 +3865,7 @@ public:
     Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals)
         : code(code), _module(_module), f_locals(std::move(locals)) {
         
-        static uint64_t frame_id = 1;
+        static thread_local uint64_t frame_id = 1;
         id = frame_id++;
     }
 

+ 1 - 1
plugins/godot/godot-cpp

@@ -1 +1 @@
-Subproject commit 5e4cc4c44a5b65a9ea53e038ffb7c83591d27698
+Subproject commit 489e88e885effa484134f98db933ca45659c2026

+ 1 - 1
src/codeobject.h

@@ -143,7 +143,7 @@ public:
     Frame(const CodeObject* code, PyVar _module, PyVarDict&& locals)
         : code(code), _module(_module), f_locals(std::move(locals)) {
         
-        static uint64_t frame_id = 1;
+        static thread_local uint64_t frame_id = 1;
         id = frame_id++;
     }
 

+ 2 - 2
src/safestl.h

@@ -64,7 +64,7 @@ public:
 
 namespace pkpy {
     const uint8_t MAX_POOLING_N = 10;
-    static std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
+    static thread_local std::vector<PyVar*>* _poolArgList = new std::vector<PyVar*>[MAX_POOLING_N];
 
     class ArgList {
         PyVar* _args = nullptr;
@@ -185,7 +185,7 @@ namespace pkpy {
     };
 
     const ArgList& noArg(){
-        static ArgList ret(0);
+        static const ArgList ret(0);
         return ret;
     }