programs/winecfg: No need to cut a backslash if it does not exist

Bruno Jesus 00cpxxx at gmail.com
Thu Oct 23 22:37:00 CDT 2014


When the code was introduced the function keypath() always appended a
backslash in the end of the string returned, but after [1] this is no
longer true (last change in the commit). So there is no point in
trying to remove the nonexistent backslash. This caused bug 37121 to
appear.

[1] http://source.winehq.org/git/wine.git/commitdiff/0d3bddc57

Fixes bug https://bugs.winehq.org/show_bug.cgi?id=37121
-------------- next part --------------
diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c
index 6106b23..83fee44 100644
--- a/programs/winecfg/appdefaults.c
+++ b/programs/winecfg/appdefaults.c
@@ -377,7 +377,6 @@ static void on_remove_app_click(HWND dialog)
 {
     HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
     int selection = get_listview_selection(listview);
-    char *section = keypath(""); /* AppDefaults\\whatever.exe\\ */
     LVITEMW item;
 
     item.iItem = selection;
@@ -388,8 +387,7 @@ static void on_remove_app_click(HWND dialog)
     
     assert( selection != 0 ); /* user cannot click this button when "default settings" is selected  */
 
-    section[strlen(section)] = '\0'; /* remove last backslash  */
-    set_reg_key(config_key, section, NULL, NULL); /* delete the section  */
+    set_reg_key(config_key, keypath(""), NULL, NULL); /* delete the section  */
     SendMessageW(listview, LVM_GETITEMW, 0, (LPARAM) &item);
     HeapFree (GetProcessHeap(), 0, (void*)item.lParam);
     SendMessageW(listview, LVM_DELETEITEM, selection, 0);


More information about the wine-patches mailing list