Hi,

> # Steps to reproduce
>
> 1. Open transmission-gtk with active torrents
> 2. Open Edit > Preferences > Speed
> 3. Interact repeatedly with any control in the "Scheduled times" section 
> (checkbox, start time, end time, day-of-week)
> 4. Crash occurs, sometimes after a few interactions
>
> The crash also occurs when the scheduled time fires automatically.
> This feature is especially useful where metered data includes 
> differently-priced "night-owl" data.

I played a bit with those controls and could not reproduce the crash.

> `Actions.cc:183` has no missing-key guard:
> ```
> $ grep -n 'key_to_action.at\|key_to_action.find' gtk/Actions.cc
> 183:    return key_to_action.at(name);
> ```
>
> The action is registered under a hyphenated name in `Actions.cc`, but 
> `Application.cc` looks it up via the raw libtransmission quark string (which 
> uses underscores):
> ```
> $ grep -n 'alt.speed.enabled' gtk/Actions.cc gtk/Application.cc
> Actions.cc:73:    "alt-speed-enabled"sv,
> Application.cc:1302:    case TR_KEY_alt_speed_enabled:
> Application.cc:1306:        
> gtr_action_set_toggled(std::string(tr_quark_get_string_view(key)), b);
> ```

>From a quick look, do you mean that the following patch might fix this?

--- i/gtk/Application.cc
+++ w/gtk/Application.cc
@@ -1275,7 +1275,7 @@ void Application::Impl::on_prefs_changed(tr_quark const 
key)
         {
             bool const b = gtr_pref_flag_get(key);
             tr_sessionUseAltSpeed(tr, b);
-            gtr_action_set_toggled(std::string(tr_quark_get_string_view(key)), 
b);
+            
gtr_action_set_toggled(std::string(tr_quark_get_string_view(TR_KEY_alt_speed_enabled_kebab_APICOMPAT)),
 b);
             break;
         }

Thanks,

Alex

Reply via email to