]> Devoid-pointer.net GitWeb - KLGD_FF_plugin.git/commitdiff
Handle transition from STARTED to EMPTY uncombinable effect correctly
authorMichal Malý <madcatxster@devoid-pointer.net>
Sat, 11 Jul 2015 09:26:13 +0000 (11:26 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sat, 11 Jul 2015 09:26:13 +0000 (11:26 +0200)
when it is being replaced by a combinable effect.

klgd_ff_plugin.c

index d1221f1cda242befecc8571e8f16fcaa0848cf98..9151724da3b3a0c6f85ae99143b23601329d6956 100644 (file)
@@ -384,9 +384,17 @@ static int ffpl_handle_combinable_effects(struct klgd_plugin_private *priv, stru
                        /* Uncombinable effect is about to be replaced by a combinable one */
                        if (ffpl_is_combinable(&eff->latest)) {
                                printk(KERN_NOTICE "KLGDFF: Replacing uncombinable with combinable\n");
-                               ret = ffpl_erase_effect(priv, s, eff);
-                               if (ret)
-                                       return ret;
+                               switch (eff->state) {
+                               case FFPL_STARTED:
+                                       ret = ffpl_stop_effect(priv, s, eff);
+                                       if (ret)
+                                               return ret;
+                               default:
+                                       ret = ffpl_erase_effect(priv, s, eff);
+                                       if (ret)
+                                               return ret;
+                                       break;
+                               }
                                eff->replace = false;
                        } else {
                        /* Combinable effect is being replaced by an uncombinable one */