예제 #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();
 }