Don't crash when flushing profile cache

Mike Hearn mh at codeweavers.com
Thu Feb 3 11:36:15 CST 2005


Don't crash when flushing profile cache
-------------- next part --------------
--- dlls/kernel/profile.c  (revision 119)
+++ dlls/kernel/profile.c  (local)
@@ -1421,22 +1421,20 @@ BOOL WINAPI WritePrivateProfileStringW( 
 
     RtlEnterCriticalSection( &PROFILE_CritSect );
 
-    if (PROFILE_Open( filename ))
+    if (!section && !entry && !string) /* documented "file flush" case */
     {
-        if (!section && !entry && !string) /* documented "file flush" case */
-        {
+        PROFILE_FlushFile();
+        PROFILE_ReleaseFile();  /* always return FALSE in this case */
+    }
+    else if (PROFILE_Open( filename ))
+    {
+        if (!section) {
+            FIXME("(NULL?,%s,%s,%s)?\n",
+                  debugstr_w(entry), debugstr_w(string), debugstr_w(filename));
+        } else {
+            ret = PROFILE_SetString( section, entry, string, FALSE);
             PROFILE_FlushFile();
-            PROFILE_ReleaseFile();  /* always return FALSE in this case */
         }
-	else {
-	    if (!section) {
-		FIXME("(NULL?,%s,%s,%s)?\n",
-                      debugstr_w(entry), debugstr_w(string), debugstr_w(filename));
-	    } else {
-		ret = PROFILE_SetString( section, entry, string, FALSE);
-		PROFILE_FlushFile();
-	    }
-	}
     }
 
     RtlLeaveCriticalSection( &PROFILE_CritSect );


More information about the wine-patches mailing list