the endless quest to plug memory leaks -- episode 378
This commit is contained in:
parent
ac8f4baa00
commit
eec294a97e
|
@ -36,20 +36,21 @@ class ControlProtocolDescriptor;
|
|||
class Session;
|
||||
|
||||
class LIBARDOUR_API ControlProtocolInfo {
|
||||
public:
|
||||
ControlProtocolDescriptor* descriptor;
|
||||
ControlProtocol* protocol;
|
||||
std::string name;
|
||||
std::string path;
|
||||
bool requested;
|
||||
bool mandatory;
|
||||
bool supports_feedback;
|
||||
XMLNode* state;
|
||||
public:
|
||||
ControlProtocolDescriptor* descriptor;
|
||||
ControlProtocol* protocol;
|
||||
std::string name;
|
||||
std::string path;
|
||||
bool requested;
|
||||
bool mandatory;
|
||||
bool supports_feedback;
|
||||
XMLNode* state;
|
||||
|
||||
ControlProtocolInfo() : descriptor (0), protocol (0), requested(false),
|
||||
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,14 +60,18 @@ 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&);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
||||
void set_divide_colors (Color top, Color bottom);
|
||||
void set_divide_height (double);
|
||||
void set_divide_colors (Color top, Color bottom);
|
||||
void set_divide_height (double);
|
||||
private:
|
||||
const Metric* _metric;
|
||||
|
||||
|
@ -76,9 +80,9 @@ private:
|
|||
|
||||
Coord _lower;
|
||||
Coord _upper;
|
||||
double _divide_height;
|
||||
Color _divider_color_top;
|
||||
Color _divider_color_bottom;
|
||||
double _divide_height;
|
||||
Color _divider_color_top;
|
||||
Color _divider_color_bottom;
|
||||
|
||||
Pango::FontDescription* _font_description;
|
||||
mutable std::vector<Mark> marks;
|
||||
|
|
|
@ -36,7 +36,8 @@ Ruler::Ruler (Canvas* c, const Metric& m)
|
|||
, _metric (&m)
|
||||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
@ -46,7 +47,8 @@ Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
|
|||
, _metric (&m)
|
||||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
@ -56,7 +58,8 @@ Ruler::Ruler (Item* parent, const Metric& m)
|
|||
, _metric (&m)
|
||||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.0)
|
||||
, _divide_height (-1.0)
|
||||
, _font_description (0)
|
||||
, _need_marks (true)
|
||||
{
|
||||
}
|
||||
|
@ -66,7 +69,8 @@ Ruler::Ruler (Item* parent, const Metric& m, Rect const& r)
|
|||
, _metric (&m)
|
||||
, _lower (0)
|
||||
, _upper (0)
|
||||
, _divide_height (-1.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…
Reference in New Issue
Block a user