[mutter/wip/carlosg/coverity-fixes: 5/13] clutter: Turn warning into assert




commit 50c074c9016be9cf6ac290aa6dd5362050ad924c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 21:12:02 2021 +0200

    clutter: Turn warning into assert
    
    This warning is actually dead code, since should_be_mapped and
    must_be_realized are always set to the same value, so it does not
    make sense to check for "a && !b".
    
    Turn this into an assert so we avoid the dead branch, but do not
    remove the variable duplication so the more aptly named variable
    is used where it belongs, for clarity.
    
    CID: #1506254

 clutter/clutter/clutter-actor.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 9a0dd48a7e..1e495c5b3a 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -1455,10 +1455,7 @@ clutter_actor_update_map_state (ClutterActor  *self,
       /* Map */
       if (should_be_mapped)
         {
-          if (!must_be_realized)
-            g_warning ("Somehow we think actor '%s' should be mapped but "
-                       "not realized, which isn't allowed",
-                       _clutter_actor_get_debug_name (self));
+          g_assert (should_be_mapped == must_be_realized);
 
           /* realization is allowed to fail (though I don't know what
            * an app is supposed to do about that - shouldn't it just


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]