WINEMENUBUILDER: when running a second time, don't fail if we can't extract an icon (RESEND)

Mike McCormack mike at codeweavers.com
Tue Feb 22 10:16:23 CST 2005


This patch supercedes the previous winemenubuilder patch, which Dmitry 
says was wrong.

Mike


ChangeLog:
* when running a second time, don't fail if we can't extract an icon
-------------- next part --------------
Index: programs/winemenubuilder/winemenubuilder.c
===================================================================
RCS file: /home/wine/wine/programs/winemenubuilder/winemenubuilder.c,v
retrieving revision 1.25
diff -u -p -r1.25 winemenubuilder.c
--- programs/winemenubuilder/winemenubuilder.c	18 Feb 2005 12:52:33 -0000	1.25
+++ programs/winemenubuilder/winemenubuilder.c	22 Feb 2005 16:16:21 -0000
@@ -737,7 +737,7 @@ static BOOL GetLinkLocation( LPCWSTR lin
     return FALSE;
 }
 
-static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link )
+static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bAgain )
 {
     char *link_name = NULL, *icon_name = NULL, *work_dir = NULL;
     char *escaped_path = NULL, *escaped_args = NULL, *escaped_description = NULL;
@@ -800,8 +800,12 @@ static BOOL InvokeShellLinker( IShellLin
     /* fail - try once again at reboot time */
     if( !icon_name )
     {
+        if (bAgain)
+        {
+            WINE_WARN("Unable to extract icon, deferring.\n");
+            goto cleanup;
+        }
         WINE_ERR("failed to extract icon.\n");
-        return FALSE;
     }
 
     /* check the path */
@@ -835,7 +839,7 @@ static BOOL InvokeShellLinker( IShellLin
     if( !link_name )
     {
         WINE_ERR("Couldn't clean up link name %s\n", wine_dbgstr_w(link));
-        return FALSE;
+        goto cleanup;
     }
 
     /* escape the path and parameters */
@@ -847,6 +851,7 @@ static BOOL InvokeShellLinker( IShellLin
                       in_desktop_dir(csidl), escaped_args, icon_name,
                       work_dir ? work_dir : "", escaped_description);
 
+cleanup:
     HeapFree( GetProcessHeap(), 0, icon_name );
     HeapFree( GetProcessHeap(), 0, work_dir );
     HeapFree( GetProcessHeap(), 0, link_name );
@@ -915,7 +920,7 @@ static BOOL Process_Link( LPCWSTR linkna
         /* If something fails (eg. Couldn't extract icon)
          * defer this menu entry to reboot via runonce
          */
-        if( ! InvokeShellLinker( sl, fullname ) && bAgain )
+        if( ! InvokeShellLinker( sl, fullname, bAgain ) && bAgain )
             DeferToRunOnce( fullname );
         else
             WINE_TRACE("Success.\n");


More information about the wine-patches mailing list