static void PreviewTextureFactory_OnImageUnloaded(string imagePath) {
     if (!m_previewTextures.ContainsKey(imagePath))
         return;
             
     PreviewTexture texToRemove = m_previewTextures[imagePath];
     texToRemove.Dispose();
     m_previewTextures.Remove(imagePath);
 }
//----------------------------------------------------------------------------------------------------------------------    
    private static void Update() {
        double curTime = EditorApplication.timeSinceStartup;
        if (!m_removeObsoleteTextures)
            return;

        //Remove obsolete textures
        m_obsoleteTextures.Clear();
        foreach (KeyValuePair<string, PreviewTexture> keyValue in m_previewTextures) {
            if (curTime - keyValue.Value.GetLastAccessTime() > OBSOLETE_TIME) {
                m_obsoleteTextures.Add(keyValue.Key);
            }
        }
        foreach (string texFullPath in m_obsoleteTextures) {
            PreviewTexture texToRemove = m_previewTextures[texFullPath];
            texToRemove.Dispose();
            m_previewTextures.Remove(texFullPath);
        }

        m_removeObsoleteTextures = false;
    }