Skip to content

Commit 8ccf528

Browse files
committed
fix: resolve Swift 6 strict concurrency warnings — Sendable, nonisolated, actor isolation
1 parent 991f0e2 commit 8ccf528

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

TableProMobile/TableProMobile/Drivers/MySQLDriver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ final class MySQLDriver: DatabaseDriver, @unchecked Sendable {
144144
}
145145

146146
func fetchForeignKeys(table: String, schema: String?) async throws -> [ForeignKeyInfo] {
147-
let safe = SQLBuilder.escapeString(table)
148-
let dbSafe = SQLBuilder.escapeString(database)
147+
let safe = table.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "'", with: "''")
148+
let dbSafe = database.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "'", with: "''")
149149
let query = """
150150
SELECT
151151
kcu.CONSTRAINT_NAME,

TableProMobile/TableProMobile/SSH/SSHTunnel.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import Foundation
99
import CLibSSH2
1010
import os
1111

12-
final class AliveFlag: @unchecked Sendable {
12+
final class AliveFlag: Sendable {
1313
private let _lock = NSLock()
14-
private var _value = true
14+
private nonisolated(unsafe) var _value = true
1515

16-
var value: Bool {
16+
nonisolated var value: Bool {
1717
get { _lock.lock(); defer { _lock.unlock() }; return _value }
1818
set { _lock.lock(); _value = newValue; _lock.unlock() }
1919
}
@@ -310,11 +310,12 @@ actor SSHTunnel {
310310
session = nil
311311
let lock = sessionLock
312312
if let sess {
313+
nonisolated(unsafe) let unsafeSess = sess
313314
Thread.detachNewThread {
314315
lock.lock()
315-
libssh2_session_set_blocking(sess, 1)
316-
tablepro_libssh2_session_disconnect(sess, "Closing tunnel")
317-
libssh2_session_free(sess)
316+
libssh2_session_set_blocking(unsafeSess, 1)
317+
tablepro_libssh2_session_disconnect(unsafeSess, "Closing tunnel")
318+
libssh2_session_free(unsafeSess)
318319
lock.unlock()
319320
}
320321
}

0 commit comments

Comments
 (0)