mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
the endless quest to plug memory leaks -- episode 378
This commit is contained in:
parent
ac8f4baa00
commit
eec294a97e
7 changed files with 64 additions and 21 deletions
|
|
@ -49,7 +49,8 @@ public:
|
|||
ControlProtocolInfo() : descriptor (0), protocol (0), requested(false),
|
||||
mandatory(false), supports_feedback(false), state (0)
|
||||
{}
|
||||
~ControlProtocolInfo() { delete state; }
|
||||
~ControlProtocolInfo();
|
||||
|
||||
};
|
||||
|
||||
class LIBARDOUR_API ControlProtocolManager : public PBD::Stateful, public ARDOUR::SessionHandlePtr
|
||||
|
|
|
|||
|
|
@ -43,6 +43,22 @@ using namespace PBD;
|
|||
ControlProtocolManager* ControlProtocolManager::_instance = 0;
|
||||
const string ControlProtocolManager::state_node_name = X_("ControlProtocols");
|
||||
|
||||
|
||||
ControlProtocolInfo::~ControlProtocolInfo ()
|
||||
{
|
||||
if (protocol && descriptor) {
|
||||
descriptor->destroy (descriptor, protocol);
|
||||
protocol = 0;
|
||||
}
|
||||
|
||||
delete state; state = 0;
|
||||
|
||||
if (descriptor) {
|
||||
delete (Glib::Module*) descriptor->module;
|
||||
descriptor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ControlProtocolManager::ControlProtocolManager ()
|
||||
{
|
||||
}
|
||||
|
|
@ -434,6 +450,7 @@ ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
|
|||
ControlProtocolInfo* cpi = cpi_by_name (prop->value());
|
||||
|
||||
if (cpi) {
|
||||
delete cpi->state;
|
||||
cpi->state = new XMLNode (**citer);
|
||||
|
||||
if (active) {
|
||||
|
|
|
|||
|
|
@ -3471,6 +3471,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
|
|||
catch (failed_constructor& err){
|
||||
error << _("Tempo map: could not set new state, restoring old one.") << endmsg;
|
||||
_metrics = old_metrics;
|
||||
old_metrics.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -3484,6 +3485,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
|
|||
catch (failed_constructor& err) {
|
||||
error << _("Tempo map: could not set new state, restoring old one.") << endmsg;
|
||||
_metrics = old_metrics;
|
||||
old_metrics.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3535,6 +3537,13 @@ TempoMap::set_state (const XMLNode& node, int /*version*/)
|
|||
}
|
||||
|
||||
recompute_map (_metrics);
|
||||
|
||||
Metrics::const_iterator d = old_metrics.begin();
|
||||
while (d != old_metrics.end()) {
|
||||
delete (*d);
|
||||
++d;
|
||||
}
|
||||
old_metrics.clear ();
|
||||
}
|
||||
|
||||
PropertyChanged (PropertyChange ());
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ public:
|
|||
Ruler (Item*, const Metric& m);
|
||||
Ruler (Item*, const Metric& m, Rect const&);
|
||||
|
||||
virtual ~Ruler () {
|
||||
delete _font_description;
|
||||
}
|
||||
|
||||
void set_range (double lower, double upper);
|
||||
void set_font_description (Pango::FontDescription);
|
||||
void set_metric (const Metric&);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ Ruler::Ruler (Canvas* c, const Metric& m)
|
|||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
|
@ -47,6 +48,7 @@ Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
|
|||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
|
@ -57,6 +59,7 @@ Ruler::Ruler (Item* parent, const Metric& m)
|
|||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
|
@ -67,6 +70,7 @@ Ruler::Ruler (Item* parent, const Metric& m, Rect const& r)
|
|||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
|
@ -85,6 +89,7 @@ void
|
|||
Ruler::set_font_description (Pango::FontDescription fd)
|
||||
{
|
||||
begin_visual_change ();
|
||||
delete _font_description;
|
||||
_font_description = new Pango::FontDescription (fd);
|
||||
end_visual_change ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ ControlList::~ControlList()
|
|||
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
||||
delete (*x);
|
||||
}
|
||||
_events.clear ();
|
||||
|
||||
delete _curve;
|
||||
}
|
||||
|
|
@ -178,6 +179,9 @@ ControlList::copy_events (const ControlList& other)
|
|||
{
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
||||
delete (*x);
|
||||
}
|
||||
_events.clear ();
|
||||
for (const_iterator i = other.begin(); i != other.end(); ++i) {
|
||||
_events.push_back (new ControlEvent ((*i)->when, (*i)->value));
|
||||
|
|
@ -216,6 +220,9 @@ ControlList::clear ()
|
|||
{
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (_lock);
|
||||
for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
|
||||
delete (*x);
|
||||
}
|
||||
_events.clear ();
|
||||
unlocked_invalidate_insert_iterator ();
|
||||
mark_dirty ();
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ pthread_set_name (const char *str)
|
|||
{
|
||||
/* copy string and delete it when exiting */
|
||||
|
||||
thread_name.set (strdup (str));
|
||||
thread_name.set (strdup (str)); // leaks
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue