File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1400,12 +1400,14 @@ impl Drop for InnerWebView {
14001400 // We need to drop handler closures here
14011401 unsafe {
14021402 if let Some ( ipc_handler) = self . ipc_handler_delegate . take ( ) {
1403- let ipc = ns_string ! ( IPC_MESSAGE_HANDLER_NAME ) ;
1404- // this will decrease the retain count of the ipc handler and trigger the drop
1405- ipc_handler
1406- . ivars ( )
1407- . controller
1408- . removeScriptMessageHandlerForName ( ipc) ;
1403+ if ipc_handler. ivars ( ) . registered_ipc_handler . get ( ) {
1404+ let ipc = ns_string ! ( IPC_MESSAGE_HANDLER_NAME ) ;
1405+ // this will decrease the retain count of the ipc handler and trigger the drop
1406+ ipc_handler
1407+ . ivars ( )
1408+ . controller
1409+ . removeScriptMessageHandlerForName ( ipc) ;
1410+ }
14091411 }
14101412
14111413 // Remove webview from window's NSView before dropping.
You can’t perform that action at this time.
0 commit comments