plug some memory leaks in libs
authorRobin Gareus <robin@gareus.org>
Sat, 12 Sep 2015 18:05:25 +0000 (20:05 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 12 Sep 2015 18:05:25 +0000 (20:05 +0200)
libs/ardour/buffer_set.cc
libs/ardour/graph.cc
libs/ardour/lv2_plugin.cc
libs/gtkmm2ext/gtkmm2ext/pixfader.h
libs/gtkmm2ext/pixfader.cc
libs/midi++2/port.cc
libs/pbd/fpu.cc
libs/pbd/pbd.cc
libs/pbd/pbd/fpu.h

index f64eec3191634b5d18d5a9020f5411493d8a6926..cd0a9c50581115bce036d56fc8fce47bca088730 100644 (file)
@@ -87,6 +87,13 @@ BufferSet::clear()
        _vst_buffers.clear ();
 #endif
 
+#ifdef LV2_SUPPORT
+       for (LV2Buffers::iterator i = _lv2_buffers.begin(); i != _lv2_buffers.end(); ++i) {
+               delete (*i).second;
+       }
+       _lv2_buffers.clear ();
+#endif
+
 }
 
 /** Set up this BufferSet so that its data structures mirror a PortSet's buffers.
index b321968daf1c38025ca3c46a5a5070144fb8cbc5..8cce0efdbccee85ccc226be6c8b88efb44866453 100644 (file)
@@ -459,6 +459,7 @@ Graph::main_thread()
         }
 
         pt->drop_buffers();
+        delete (pt);
 }
 
 void
index 13241f2a8bea8392ab2e9a58df5a888fea468c7f..56f1adcc905643140a407bc823ad25a4f76b9d2a 100644 (file)
@@ -699,6 +699,7 @@ LV2Plugin::~LV2Plugin ()
 
        delete [] _control_data;
        delete [] _shadow_data;
+       delete [] _defaults;
        delete [] _ev_buffers;
 }
 
index 0a316340b49f035b9e774c6f13c5edf5a2eefe27..c5ed9c585c6a07bd3d30b072c9005ad80802dfcc 100644 (file)
@@ -36,6 +36,7 @@ class LIBGTKMM2EXT_API PixFader : public CairoWidget
        public:
        PixFader (Gtk::Adjustment& adjustment, int orientation, int span, int girth);
        virtual ~PixFader ();
+       static void flush_pattern_cache();
 
        sigc::signal<void> StartGesture;
        sigc::signal<void> StopGesture;
index 1e814fd147517b6aa6b0b2ae77f7a06e28cc0004..e27945128e3feb44330fdb522017c0eb1610c7ae 100644 (file)
@@ -85,6 +85,15 @@ PixFader::~PixFader ()
        if (_layout) _layout.clear (); // drop reference to existing layout
 }
 
+void
+PixFader::flush_pattern_cache () {
+       for (list<FaderImage*>::iterator f = _patterns.begin(); f != _patterns.end(); ++f) {
+               cairo_pattern_destroy ((*f)->pattern);
+       }
+       _patterns.clear();
+}
+
+
 cairo_pattern_t*
 PixFader::find_pattern (double afr, double afg, double afb,
                        double abr, double abg, double abb,
index 90ec260eae1cb8822a0e12f2bfdbb66d715d2275..b7d12872e86d3abf1c6cbf56a05fe05ab18edf3e 100644 (file)
@@ -81,6 +81,8 @@ Port::~Port ()
        for (int i = 0; i < 16; i++) {
                delete _channel[i];
        }
+
+       delete _parser;
 }
 
 /** Send a clock tick message.
index 97e6ed59dd209d92377f20f481e9c547876cdecb..33e646f7440ca07c0df0d3ebf2a51c047b6d16b7 100644 (file)
@@ -129,6 +129,13 @@ FPU::instance()
        return _instance;
 }
 
+void
+FPU::destroy ()
+{
+       delete _instance;
+       _instance = 0;
+}
+
 FPU::FPU ()
        : _flags ((Flags) 0)
 {
index 17d15887889fbac4ee98c373bb054d77b5556b2a..cf7e523349cb7c84c08d35821d27ca0e7685cd38 100644 (file)
@@ -34,6 +34,7 @@
 #include "pbd/error.h"
 #include "pbd/id.h"
 #include "pbd/enumwriter.h"
+#include "pbd/fpu.h"
 
 #ifdef PLATFORM_WINDOWS
 #include <winsock2.h>
@@ -111,4 +112,5 @@ PBD::cleanup ()
 #endif 
 
        EnumWriter::destroy ();
+       FPU::destroy ();
 }
index 4ab1a835610a7d11cdc7876a17c06ecbef23c4f9..463fef3ff2809baf6d3362a347dbd1b453c875a7 100644 (file)
@@ -38,6 +38,7 @@ class LIBPBD_API FPU {
        ~FPU ();
 
        static FPU* instance();
+       static void destroy();
        
        bool has_flush_to_zero () const { return _flags & HasFlushToZero; }
        bool has_denormals_are_zero () const { return _flags & HasDenormalsAreZero; }