Skip to content

Commit

Permalink
check length of callstack frames before slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
heckj committed May 7, 2024
1 parent cf60fe3 commit 85131a4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Sources/Automerge/BoundTypes/AutomergeText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,15 @@ extension AutomergeText: ObservableObject {
if #available(macOS 11, iOS 14, *) {
let logger = Logger(subsystem: "Automerge", category: "AutomergeText")
logger.trace("\(self.debugDescription) sending ObjectWillChange")
for callStackFrame in Thread.callStackSymbols[0 ... 6] {
logger.trace(" - \(callStackFrame)")
let callStacks = Thread.callStackSymbols
if callStacks.count > 5 {
for callStackFrame in callStacks[0 ... 5] {
logger.trace(" - \(callStackFrame)")
}
} else {
for callStackFrame in callStacks {
logger.trace(" - \(callStackFrame)")
}
}
}
#endif
Expand Down
11 changes: 9 additions & 2 deletions Sources/Automerge/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1065,8 +1065,15 @@ extension Document: ObservableObject {
// ch.debugDescription
// }.joined(separator: ".")
// logger.trace("heads: \(headsString)")
for callStackFrame in Thread.callStackSymbols[0 ... 5] {
logger.trace(" - \(callStackFrame)")
let callStacks = Thread.callStackSymbols
if callStacks.count > 5 {
for callStackFrame in callStacks[0 ... 5] {
logger.trace(" - \(callStackFrame)")
}
} else {
for callStackFrame in callStacks {
logger.trace(" - \(callStackFrame)")
}
}
}
#endif
Expand Down

0 comments on commit 85131a4

Please sign in to comment.