Relax setUnhandledExceptionHook requirements with the new MM (#4675)

This commit is contained in:
Alexander Shabalin
2021-02-02 18:03:55 +03:00
committed by Vasily Levchenko
parent 2b69a0d03a
commit 99dc9e8e0c
2 changed files with 20 additions and 6 deletions
@@ -45,7 +45,7 @@ public typealias ReportUnhandledExceptionHook = Function1<Throwable, Unit>
* with custom exception hooks.
*/
public fun setUnhandledExceptionHook(hook: ReportUnhandledExceptionHook): ReportUnhandledExceptionHook? {
if (!hook.isFrozen) {
if (Platform.memoryModel != MemoryModel.EXPERIMENTAL && !hook.isFrozen) {
throw InvalidMutabilityException("Unhandled exception hook must be frozen")
}
return setUnhandledExceptionHook0(hook)