[PATCH] winemenubuilder: Only extract icons when association changed.

Rémi Bernon rbernon at codeweavers.com
Fri Nov 13 03:30:56 CST 2020


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

On every prefix startup, we extract and convert the icons to PNG for
every associated application. Although they are small, PNG conversion
is still lengthy, and we don't have to do it every time.

 programs/winemenubuilder/winemenubuilder.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index ee53619bb9e..0ae1383d4bf 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -2657,7 +2657,7 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
 
             executableW = assoc_query(ASSOCSTR_EXECUTABLE, extensionW, openW);
             if (executableW)
-                openWithIconA = extract_icon(executableW, 0, NULL, FALSE);
+                openWithIconA = compute_native_identifier(0, executableW);
 
             friendlyAppNameW = assoc_query(ASSOCSTR_FRIENDLYAPPNAME, extensionW, openW);
             if (friendlyAppNameW)
@@ -2730,6 +2730,12 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
                 }
             }
 
+            if (hasChanged && openWithIconA)
+            {
+                char *outputIconA = extract_icon(executableW, 0, openWithIconA, FALSE);
+                HeapFree(GetProcessHeap(), 0, outputIconA);
+            }
+
         end:
             HeapFree(GetProcessHeap(), 0, extensionA);
             HeapFree(GetProcessHeap(), 0, commandW);
-- 
2.29.2




More information about the wine-devel mailing list