clean up some valgrid "Uninitialised value was created by a heap allocation" wanings
authorRobin Gareus <robin@gareus.org>
Wed, 31 Jul 2013 17:24:26 +0000 (19:24 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 31 Jul 2013 17:29:20 +0000 (19:29 +0200)
gtk2_ardour/level_meter.cc
libs/gtkmm2ext/fastmeter.cc

index 6f977e1f33fc9e06d03c01491a21a8aa357052dc..66dda804b1e0d6c95f3e8dfb4f6b76ebc0a8c531 100644 (file)
@@ -47,6 +47,7 @@ LevelMeterBase::LevelMeterBase (Session* s, PBD::EventLoop::InvalidationRecord*
        : parent_invalidator(ir)
        , _meter (0)
        , _meter_orientation(o)
+       , regular_meter_width (6)
        , meter_length (0)
        , thin_meter_width(2)
 {
@@ -382,6 +383,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
                }
                if (meters[n].width != width || meters[n].length != len || color_changed || meter_type != visible_meter_type) {
                        bool hl = meters[n].meter ? meters[n].meter->get_highlight() : false;
+                       meters[n].packed = false;
                        delete meters[n].meter;
                        meters[n].meter = new FastMeter ((uint32_t) floor (Config->get_meter_hold()), width, _meter_orientation, len,
                                        c[0], c[1], c[2], c[3], c[4],
index 022962a7e17253e8752e540f8dd09ec316c11ff6..d826def7ff60fa3f3c99dd7cc22f6cab8e59385a 100644 (file)
@@ -57,17 +57,22 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
                float stp2, float stp3,
                int styleflags
                )
+       : pixheight(0)
+       , pixwidth(0)
+       , _styleflags(styleflags)
+       , orientation(o)
+       , hold_cnt(hold)
+       , hold_state(0)
+       , bright_hold(false)
+       , current_level(0)
+       , current_peak(0)
+       , highlight(false)
 {
-       orientation = o;
-       hold_cnt = hold;
-       hold_state = 0;
-       bright_hold = false;
-       current_peak = 0;
-       current_level = 0;
        last_peak_rect.width = 0;
        last_peak_rect.height = 0;
+       last_peak_rect.x = 0;
+       last_peak_rect.y = 0;
 
-       highlight = false;
        no_rgba_overlay = ! Glib::getenv("NO_METER_SHADE").empty();
 
        _clr[0] = clr0;
@@ -92,8 +97,6 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
        _stp[2] = stp2;
        _stp[3] = stp3;
 
-       _styleflags = styleflags;
-
        set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
 
        pixrect.x = 1;
@@ -690,6 +693,8 @@ FastMeter::set (float lvl, float peak)
        float old_level = current_level;
        float old_peak = current_peak;
 
+       if (pixwidth <= 0 || pixheight <=0) return;
+
        if (peak == -1) {
                if (lvl >= current_peak) {
                        current_peak = lvl;