/// <summary>
        /// Unlock the script access token if it is only locked by this script access reference.
        /// </summary>
        /// <param name="accessref">A script access reference to this script access token.</param>
        public void Unlock(ScriptAccessRef accessref)
        {
            accessrefs_.Remove(accessref);
            if (accessref.EngineId == EngineId && !accessrefs_.Exists(ar => ar.EngineId == EngineId))
            {
                // unlock this script access token because it was locked by this script access reference
                // and is not accessed by any other script access references from the same script engine
                EngineId = 0;
            }

            if (accessrefs_.Count == 0)
            {
                // script access token is no longer needed
                HiddenCodeAux.RemoveAccessToken(lockname_);
            }
        }
 /// <summary>
 /// Add a script access reference.
 /// </summary>
 /// <param name="accessref">Script access reference.</param>
 internal void AddAccessRef(ScriptAccessRef accessref)
 {
     accessrefs_.Add(accessref);
 }