@op-engineering/op-sqlite 15.2.5 → 15.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -236,11 +236,16 @@ void DBHostObject::create_jsi_functions(jsi::Runtime &rt) {
236
236
 
237
237
  function_map["close"] = HFN(this) {
238
238
  invalidated = true;
239
-
239
+ // Drain any in-flight async queries before closing the db handle.
240
+ // Without this, a queued/running execute() on the thread pool may
241
+ // dereference the freed sqlite3* pointer → heap corruption / SIGABRT.
242
+ thread_pool->waitFinished();
240
243
  #ifdef OP_SQLITE_USE_LIBSQL
241
244
  opsqlite_libsql_close(db);
245
+ db = {};
242
246
  #else
243
247
  opsqlite_close(db);
248
+ db = nullptr;
244
249
  #endif
245
250
 
246
251
  return {};
@@ -671,7 +676,13 @@ void DBHostObject::invalidate() {
671
676
  }
672
677
 
673
678
  invalidated = true;
674
- thread_pool->restartPool();
679
+ // Drain in-flight thread pool work before closing the db handle.
680
+ // restartPool() joins threads (waiting for the current task) but then
681
+ // needlessly re-creates the pool. waitFinished() is sufficient: it
682
+ // blocks until the queue is empty and no worker is busy, then the
683
+ // ThreadPool destructor (via shared_ptr release) joins the threads.
684
+ thread_pool->waitFinished();
685
+
675
686
  #ifdef OP_SQLITE_USE_LIBSQL
676
687
  opsqlite_libsql_close(db);
677
688
  #else
@@ -74,10 +74,14 @@ void ThreadPool::doWork() {
74
74
 
75
75
  task = workQueue.front();
76
76
  workQueue.pop();
77
+ ++busy;
77
78
  }
78
- ++busy;
79
79
  task();
80
- --busy;
80
+ {
81
+ std::lock_guard<std::mutex> g(workQueueMutex);
82
+ --busy;
83
+ }
84
+ workQueueConditionVariable.notify_one();
81
85
  }
82
86
  }
83
87
 
@@ -18,12 +18,13 @@
18
18
  </dict>
19
19
  <dict>
20
20
  <key>LibraryIdentifier</key>
21
- <string>ios-arm64-simulator</string>
21
+ <string>ios-arm64_x86_64-simulator</string>
22
22
  <key>LibraryPath</key>
23
23
  <string>libsql_experimental.framework</string>
24
24
  <key>SupportedArchitectures</key>
25
25
  <array>
26
26
  <string>arm64</string>
27
+ <string>x86_64</string>
27
28
  </array>
28
29
  <key>SupportedPlatform</key>
29
30
  <string>ios</string>
package/op-sqlite.podspec CHANGED
@@ -77,10 +77,14 @@ if phone_version then
77
77
  end
78
78
 
79
79
  if use_sqlite_vec then
80
- raise "SQLite Vec is not supported with phone version. It cannot load extensions."
80
+ raise "sqlite-vec is not supported with phone version. It cannot load extensions."
81
81
  end
82
82
  end
83
83
 
84
+ if use_libsql and use_sqlite_vec then
85
+ raise "You cannot use sqlite-vec with libsql. libsql already has vector search included."
86
+ end
87
+
84
88
  Pod::Spec.new do |s|
85
89
  s.name = "op-sqlite"
86
90
  s.version = package["version"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "15.2.5",
3
+ "version": "15.2.7",
4
4
  "description": "Fastest SQLite for React Native (with node.js support)",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",