You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calendar's some functions is not guarded with CoW.
Calendar wraps NSCalendar and it uses _applyMutation for any mutating actions.
but next two functions on NSCalendar mutates itself in the function. This behavior slips through the CoW.
Problem
Calendar
's some functions is not guarded with CoW.Calendar
wrapsNSCalendar
and it uses_applyMutation
for any mutating actions.but next two functions on
NSCalendar
mutates itself in the function. This behavior slips through the CoW.https://github.com/apple/swift-corelibs-foundation/blob/d248649df1fd102269c0ba312220a1922b4f8bec/Sources/Foundation/NSCalendar.swift#L490-L509
https://github.com/apple/swift-corelibs-foundation/blob/d248649df1fd102269c0ba312220a1922b4f8bec/Sources/Foundation/NSCalendar.swift#L756-L762
When we use these functions in another thread using copied
Calendar
, may cause unexpected behavior.How to reproduce
Run this code in Linux environemnt.
Sometimes prints
"bug!"
or sometimes crashes.Expected
Calendar
's CoW works right.I know
Calendar
is not thread safe unlike the Apple platform. This issue focuses abount CoW.The text was updated successfully, but these errors were encountered: