Fix: Replace AsyncWorker with ThreadSafeFunction to prevent crashes#1
Conversation
- Replaced CalendarAccessWorker, RemindersAccessWorker, and RemindersFetchWorker with thread-safe context structs - Use ThreadSafeFunction instead of AsyncWorker for cross-thread callbacks - Capture shared_ptr by value in lambdas to ensure promise lifetime - Fixes segmentation fault when macOS permission dialog callback fires This fixes crash at memory address 0x260 when users grant calendar permissions.
|
@dacay let me start by saying I'm not an Objective-C coder or a Swift coder of any kind. I found that EventKit-node was crashing after accepting permissions when I went to use it. I had Claude code fix that issue, and the code that's in this fork seems to continue to maintain all the functionality that existed in your version, but doesn't crash after receiving proper permissions on macOS 26.2 Tahoe. |
|
Hey @brandonkboswell thank you the PR! Sorry to notice this, it was lost between other notifications. While I have some production experience with Swift/Objective-C, I am not a native developer as well. This was one of my earliest AI-supported projects, so most of the low-level bindings were coded by AI. I liked the approach Claude suggested. I got mine go over it as well, and it 2 issues that still poses an issue and some dead code after this migration. Let me share it's report with you here: I've pushed the fixes on top of your commit on a branch and will merge from there. Thanks again! |
- Add missing startDate field in RemindersFetchContext - Convert Commit function to use ThreadSafeFunction - Remove unused RemoveCalendarWorker and RemindersFetchWorker classes Builds on top of brandonkboswell's AsyncWorker to ThreadSafeFunction refactor.
|
Merged, thanks for the contribution! |
This fixes crash at memory address 0x260 when users grant calendar permissions.