Пример #1
0
 public void Dispose()
 {
     lock (_lock ?? new object())
     {
         _parent?.Release();
         _parent = null;
         GC.SuppressFinalize(this);
     }
 }
Пример #2
0
 public IRef <EditorSession> GetSession(string path)
 {
     lock (_sessions)
     {
         if (_sessions.TryGetValue(path, out var rc) && rc.IsAlive)
         {
             return(rc.CreateRef());
         }
         var xaml = _loadFromDisk ? File.ReadAllText(path) : "";
         rc = new RefCountable <EditorSession>(new EditorSession(_w, path, xaml));
         _sessions[path] = rc;
         return(rc.CreateRef());
     }
 }
Пример #3
0
        public static (RefCountable <T> rc, IRef <T> r) Create(T item)
        {
            var r = new RefCountable <T>(item);

            return(r, new Ref(r));
        }
Пример #4
0
 public Ref(RefCountable <T> parent)
 {
     _parent = parent;
     parent.AddRef();
 }