       # Track delegate object's life time, and tell the browser to clean up
       # when the object is GCed.
       v8_util.setDestructor ret, ->
+        return unless currentContextExist
         ipc.sendChannel 'ATOM_BROWSER_DEREFERENCE', meta.storeId
 
       # Mark this is a remote object.

ipc = require 'ipc'
v8_util = process.atomBinding 'v8_util'

class CallbacksRegistry
  @nextId = 0


# Release all resources of current render view when it's going to be unloaded.
window.addEventListener 'unload', (event) ->
  currentContextExist = false
  ipc.sendChannelSync 'ATOM_BROWSER_RELEASE_RENDER_VIEW'

# Get remote module.
