[cluttermm/cluttermm-1-24] test-actors: Correct nonsensical code.



commit bf83838498ced886abc8ef957b7aa8a9720e961e
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Apr 21 09:33:19 2016 +0200

    test-actors: Correct nonsensical code.
    
    This was trying to add two RefPtrs together. The compiler seems to
    catch this stupidity now that RefPtr's operator bool is explicit,
    as is possible in C++11.
    
    This was my fault:
    https://git.gnome.org/browse/cluttermm/commit/examples/test-actors.cc?h=cluttermm-1-24&id=c6540163

 examples/test-actors.cc |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/examples/test-actors.cc b/examples/test-actors.cc
index 831ef95..56cef49 100644
--- a/examples/test-actors.cc
+++ b/examples/test-actors.cc
@@ -12,8 +12,11 @@ const unsigned int N_ACTORS = 6;
 
 unsigned int get_radius(const Glib::RefPtr<Clutter::Stage>& stage, unsigned int num_actors)
 {
-  return (stage
-    + stage) / num_actors;
+  if (!stage) {
+    return 0;
+  }
+
+  return (stage->get_height() + stage->get_height()) / num_actors;
 }
 
 class SuperOH


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