Commit b5acd127 authored by Locatelli's avatar Locatelli
Browse files

Improve memory leaks

parent ee972f8d
- recompute projections x and y min max values when zooming
- move icons to a system directory and not in the project
- status bar with mouse coordinates using qt event and not matplotib one
- nomad server restart ploty2 at during its starting
- nomad gui closing shall closed plot windows
- nomad gui starting shall restart previous display plot windows
- recover size and position of plots and also states for grid, log , aspect ratio ....
- Do offscreen for web plots and multiwindow plot
- bring plot to front wait it was already open
- send offscreen log image to log system
\ No newline at end of file
* move icons to a system directory and not in the project
* See possible using of CUDA acceleration
* Multiclient options
- no offscreen log, webspy plots
- offscreen plots for spy and multiplot will be regenerated or taken form the nomad server computer
* ROI
* Cut windows
* Bugs:
- Plot1D crash after several time using it, see core file, pb QT event
- Problem to pass from empty data to others
- Problem close a plot take a time in cameo, so if restarting a new before finishing previous does not worked
......@@ -46,7 +46,7 @@ namespace bp = boost::python;
//void figure() {
// cout << "figure lock: " << endl;
// view::mpl::MplLock lock(__PRETTY_FUNCTION__);
// view::mpl::MplLock lock;
// cout << "figure lock past" << endl;
// bp::object fig = pyPlot.attr("figure")();
// cout << "figure : " << fig.is_none() << endl;
......@@ -56,32 +56,6 @@ namespace bp = boost::python;
//
//
class SavePlot;
unordered_map<string, pair<thread*, SavePlot *>> tm_;
static std::mutex m_Mutex;
bool intm(const string& id) {
unordered_map<string, pair<thread*, SavePlot *>>::iterator it = tm_.find(id);
return (it != tm_.end());
}
void addtm(const string& id, thread* td, SavePlot* sp) {
std::lock_guard<std::mutex> lock(m_Mutex);
tm_[id] = make_pair(td, sp);
cout << "add id " << id << " " << tm_.size() << endl;
}
void deltm(const string& id) {
std::lock_guard<std::mutex> lock(m_Mutex);
unordered_map<string, pair<thread*, SavePlot *>>::iterator it = tm_.find(id);
if (it != tm_.end()) {
delete it->second.first;
delete it->second.second;
tm_.erase(id);
cout << "del id " << id << " " << tm_.size() << endl;
}
}
/*!
* \brief Save plot object for multithread offscreen plot
......@@ -97,7 +71,7 @@ public:
* \param[in] path the path directory of the pb file
*/
SavePlot(view::mpl::Mpl* mpl, const std::string& pbfilename, const std::string& path);
SavePlot();
/*!
* \brief do save action
*/
......@@ -110,6 +84,42 @@ private:
std::string m_Path; //! The path directory of the pb file
};
unordered_map<string, thread> tm_;
unordered_map<string, SavePlot> spm_;
static std::mutex m_Mutex;
bool intm(const string& id) {
unordered_map<string, thread>::iterator it = tm_.find(id);
return (it != tm_.end());
}
void addtm(view::mpl::Mpl* mpl, const string& id, const string& path) {
std::lock_guard<std::mutex> lock(m_Mutex);
if (!intm(id)) {
SavePlot sp1(mpl, id, path);
thread t1(bind(&SavePlot::run, sp1));
t1.detach();
tm_[id] = std::move(t1);
spm_[id] = std::move(sp1);
cout << "add id " << id << " " << tm_.size() << endl;
}
}
void deltm(const string& id) {
string lid = std::move(id);
std::lock_guard<std::mutex> lock(m_Mutex);
unordered_map<string, thread>::iterator it = tm_.find(lid);
if (it != tm_.end()) {
it->second.std::thread::~thread();
tm_.erase(lid);
cout << "del id " << lid << " " << tm_.size() << endl;
}
unordered_map<string, SavePlot>::iterator it2 = spm_.find(lid);
if (it2 != spm_.end()) {
spm_.erase(lid);
cout << "del id " << lid << " " << spm_.size() << endl;
}
}
/*
* savePlot
......@@ -119,6 +129,12 @@ SavePlot::SavePlot(view::mpl::Mpl* mpl, const std::string& pbfilename, const std
m_Pbfilename = pbfilename;
m_Path = path;
}
/*
* savePlot
*/
SavePlot::SavePlot() {
m_Mpl = nullptr;
}
/*
* savePlot
......@@ -224,55 +240,19 @@ void test(view::mpl::Mpl* mpl) {
uint32 i = 0;
while (true) {
if (!intm("plot#detector_plot_data0#Detector.png")) {
SavePlot* sp1 = new SavePlot(mpl, "plot#detector_plot_data0#Detector.png", "/users/locatelli/offscreenImages/web/pb");
thread* t1 = new thread(bind(&SavePlot::run, sp1));
t1->detach();
addtm("plot#detector_plot_data0#Detector.png", t1, sp1);
}
if (!intm("ScanSpy#scanSpyPlot0.png")) {
SavePlot* sp2 = new SavePlot(mpl, "ScanSpy#scanSpyPlot0.png", "/users/locatelli/offscreenImages/web/pb");
thread* t2 = new thread(bind(&SavePlot::run, sp2));
t2->detach();
addtm("ScanSpy#scanSpyPlot0.png", t2, sp2);
}
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// SavePlot* sp3 = new SavePlot(mpl, "plot#detector_plot_data.0.0#0.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t3(bind(&SavePlot::run, sp3));
// t3.detach();
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// SavePlot* sp4 = new SavePlot(mpl, "plot#detector_plot_data.0.0#1.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t4(bind(&SavePlot::run, sp4));
// t4.detach();
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// SavePlot* sp5 = new SavePlot(mpl, "plot#detector_plot_data.0.0#2.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t5(bind(&SavePlot::run, sp5));
// t5.detach();
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// SavePlot* sp6 = new SavePlot(mpl, "plot#detector_plot_data.0.0#3.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t6(bind(&SavePlot::run, sp6));
// t6.detach();
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// SavePlot* sp7 = new SavePlot(mpl, "plot#detector_plot_data.0.0#4.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t7(bind(&SavePlot::run, sp7));
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// t7.detach();
// SavePlot* sp8 = new SavePlot(mpl, "plot#detector_plot_data.0.0#5.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t8(bind(&SavePlot::run, sp8));
// tm_["plot#detector_plot_data0#Detector.png"] = std::move(t1);
// t8.detach();
// SavePlot* sp9 = new SavePlot(mpl, "plot#detector_plot_data.0.0#6.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t9(bind(&SavePlot::run, sp9));
// t9.detach();
// SavePlot* sp10 = new SavePlot(mpl, "plot#detector_plot_data.0.0#7.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t10(bind(&SavePlot::run, sp10));
// t10.detach();
// SavePlot* sp11 = new SavePlot(mpl, "plot#detector_plot_data.0.0#8.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t11(bind(&SavePlot::run, sp11));
// t11.detach();
// SavePlot* sp12 = new SavePlot(mpl, "plot#detector_plot_data.0.0#9.png", "/users/locatelli/offscreenImages/multiplot/pb");
// thread t12(bind(&SavePlot::run, sp12));
// t12.detach();
addtm(mpl, "plot#detector_plot_data0#Detector.png", "/users/locatelli/offscreenImages/web/pb");
addtm(mpl, "ScanSpy#scanSpyPlot0.png", "/users/locatelli/offscreenImages/web/pb");
addtm(mpl, "plot#detector_plot_data.0.0#0.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#1.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#2.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#3.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#4.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#5.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#6.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#7.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#8.png", "/users/locatelli/offscreenImages/multiplot/pb");
addtm(mpl, "plot#detector_plot_data.0.0#9.png", "/users/locatelli/offscreenImages/multiplot/pb");
//break;
if (++i > 1000) break;
this_thread::sleep_for(chrono::milliseconds(500));
}
......@@ -296,7 +276,7 @@ int main() {
//
//// cout << "lock" << endl;
//// {
////// view::mpl::MplLock lock(__PRETTY_FUNCTION__);
////// view::mpl::MplLock lock;
// cout << "matplotlib" << endl;
// matplotlib = bp::import(bp::str("matplotlib"));
////
......@@ -308,7 +288,7 @@ int main() {
//// PyThreadState* threadState = PyEval_SaveThread();
////// vector<thread*> threads;
// for(uint32 i = 0; i <10; ++i) {
//// view::mpl::MplLock lock(__PRETTY_FUNCTION__);
//// view::mpl::MplLock lock;
//// cout << "figure lock past" << endl;
// bp::object fig = pyPlot.attr("figure")();
// cout << "figure : " << fig.is_none() << endl;
......
......@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
// buf << counter++;
// window->set(buf.str());
// {
// view::mpl::MplLock lock(__PRETTY_FUNCTION__);
// view::mpl::MplLock lock;
// x.push_back(x.size() + 1);
// y.push_back(1);
// try {
......
......@@ -101,11 +101,13 @@ void OffScreenPlotManager::loop(application::Subscriber* subscriber) {
if (messageType.type() == notification::Message::ImageDataReady) {
notification::ImageDataReady messageImageReady;
try {
messageImageReady.ParseFromString(data2);
SavePlot* sp = new SavePlot(m_CounterId, m_Mpl, messageImageReady.imagename(), messageImageReady.imagepath());
thread* td = new thread(bind(&SavePlot::run, sp));
td->detach();
addThreadMapElement(m_CounterId++, td, sp);
addThreadMapElement(m_Mpl, m_CounterId++, messageImageReady.imagename(), messageImageReady.imagepath());
}
catch (std::bad_alloc &e) {
Error("OffScreenPlotManager", "loop", "Bad parsing of ImageDataReady");
}
}
} else {
break;
......@@ -116,9 +118,15 @@ void OffScreenPlotManager::loop(application::Subscriber* subscriber) {
/*
* addThreadMapElement
*/
void OffScreenPlotManager::addThreadMapElement(uint32 id, std::thread* td, SavePlot* sp) {
void OffScreenPlotManager::addThreadMapElement(view::mpl::Mpl* mpl, uint32 id, std::string pbfilename, std::string path) {
std::lock_guard<std::mutex> lock(m_ThreadMapMutex);
m_ThreadMap[id] = make_pair(td, sp);
if (m_ThreadMap.find(id) == m_ThreadMap.end()) {
SavePlot sp(m_CounterId, m_Mpl, pbfilename, path);
thread td(bind(&SavePlot::run, sp));
td.detach();
m_ThreadMap[id] = std::move(td);
m_SavePlotMap[id] = std::move(sp);
}
}
/*
......@@ -128,10 +136,13 @@ void OffScreenPlotManager::delThreadMapElement(uint32 id) {
std::lock_guard<std::mutex> lock(m_ThreadMapMutex);
ThreadMap::iterator it = m_ThreadMap.find(id);
if (it != m_ThreadMap.end()) {
delete it->second.first;
delete it->second.second;
it->second.std::thread::~thread();
m_ThreadMap.erase(id);
}
SavePlotMap::iterator it1 = m_SavePlotMap.find(id);
if (it1 != m_SavePlotMap.end()) {
m_SavePlotMap.erase(id);
}
}
/*
......@@ -144,6 +155,13 @@ SavePlot::SavePlot(uint32 id, view::mpl::Mpl* mpl, const std::string& pbfilename
m_Path = path;
}
/*
* savePlot
*/
SavePlot::SavePlot() {
m_Mpl = nullptr;
}
/*
* savePlot
*/
......
......@@ -36,6 +36,11 @@ class SavePlot {
public:
/*!
* \brief constructor
*/
SavePlot();
/*!
* \brief constructor
* \param[in] mpl The mpl object
......@@ -113,14 +118,16 @@ private:
*/
void reset();
void addThreadMapElement(uint32 id, std::thread* td, SavePlot* sp);
void addThreadMapElement(view::mpl::Mpl* mpl, uint32 id, std::string pbfilename, std::string path);
static OffScreenPlotManager* m_Instance; //! Pointer of singleton instance
view::mpl::Mpl* m_Mpl; //! Mpl object (main class which managed the matplotib api)
typedef std::unordered_map<uint32, std::pair<std::thread*, SavePlot*>> ThreadMap;
typedef std::unordered_map<uint32, std::thread> ThreadMap;
typedef std::unordered_map<uint32, SavePlot> SavePlotMap;
ThreadMap m_ThreadMap;
SavePlotMap m_SavePlotMap;
std::mutex m_ThreadMapMutex;
uint32 m_CounterId;
};
......
......@@ -48,7 +48,7 @@ MplEventManager::MplEventManager() {
* constructor
*/
MplEventManager::~MplEventManager() {
MplLock lock(__PRETTY_FUNCTION__);
MplLock lock;
m_ModuleEvent = bp::object();
}
......@@ -57,7 +57,7 @@ MplEventManager::~MplEventManager() {
*/
void MplEventManager::init(view::mpl::Mpl* mpl) {
m_mpl = mpl;
MplLock lock(__PRETTY_FUNCTION__);
MplLock lock;
try {
m_ModuleEvent = bp::import(bp::str(MODULE_EVENT_NAME));
} catch (...) {
......@@ -96,7 +96,7 @@ MplEventManager* MplEventManager::getInstance() {
* subscriberXLimChanged
*/
void MplEventManager::subscribeXLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error) {
MplLock mpllock(__PRETTY_FUNCTION__);
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_XLimChangedMutex);
if (m_XLimChangedSubcribers.find(obj) == m_XLimChangedSubcribers.end()) {
// Connect pick event
......@@ -112,7 +112,7 @@ void MplEventManager::subscribeXLimChanged(bp::object* obj, MplEventSubscriber*
* unsubscriberXLimChanged
*/
void MplEventManager::unsubscribeXLimChanged(bp::object* obj) throw (Error) {
MplLock mpllock(__PRETTY_FUNCTION__);
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_XLimChangedMutex);
// remove subscriber from map
if (m_XLimChangedSubcribers.find(obj) != m_XLimChangedSubcribers.end()) {
......@@ -145,7 +145,7 @@ void MplEventManager::xlimChanged(PyObject *self, PyObject* event) {
* subscriberYLimChanged
*/
void MplEventManager::subscribeYLimChanged(bp::object* obj, MplEventSubscriber* subscriber) throw (Error) {
MplLock mpllock(__PRETTY_FUNCTION__);
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_YLimChangedMutex);
if (m_YLimChangedSubcribers.find(obj) == m_YLimChangedSubcribers.end()) {
// Connect pick event
......@@ -161,7 +161,7 @@ void MplEventManager::subscribeYLimChanged(bp::object* obj, MplEventSubscriber*
* unsubscriberYLimChanged
*/
void MplEventManager::unsubscribeYLimChanged(bp::object* obj) throw (Error) {
MplLock mpllock(__PRETTY_FUNCTION__);
MplLock mpllock;
unique_lock<recursive_mutex> lock(m_YLimChangedMutex);
// remove subscriber from map
if (m_YLimChangedSubcribers.find(obj) != m_YLimChangedSubcribers.end()) {
......
......@@ -282,8 +282,8 @@ void PropertyPlot2D::updateProjections() {
if (lims[1] >= m_dataprojx.size()) {
lims[1] = m_dataprojx.size() - 1;
}
float64 projymin = *std::min_element(m_dataprojx.begin() + lims[0], m_dataprojx.begin() + lims[1]);
float64 projymax = *std::max_element(m_dataprojx.begin() + lims[0], m_dataprojx.begin() + lims[1]);
float64 projymin = *std::min_element(m_dataprojx.begin() + lims[0], m_dataprojx.begin() + lims[1] + 1);
float64 projymax = *std::max_element(m_dataprojx.begin() + lims[0], m_dataprojx.begin() + lims[1] + 1);
m_MplPlot2D.set_projxlim(projymin, projymax);
}
// Reset y data limits of Y projection
......@@ -294,8 +294,8 @@ void PropertyPlot2D::updateProjections() {
if (lims[3] >= m_dataprojy.size()) {
lims[3] = m_dataprojy.size() - 1;
}
float64 projxmin = *std::min_element(m_dataprojy.begin() + lims[2], m_dataprojy.begin() + lims[3]);
float64 projxmax = *std::max_element(m_dataprojy.begin() + lims[2], m_dataprojy.begin() + lims[3]);
float64 projxmin = *std::min_element(m_dataprojy.begin() + lims[2], m_dataprojy.begin() + lims[3] + 1);
float64 projxmax = *std::max_element(m_dataprojy.begin() + lims[2], m_dataprojy.begin() + lims[3] + 1);
m_MplPlot2D.set_projylim(projxmin, projxmax);
}
// Update image on mpl plot
......
......@@ -45,7 +45,7 @@ const sipAPIDef *sipAPI() {
*/
template<typename T> T *extract(const boost::python::object &obj) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
const auto sipapi = sipAPI();
if (!PyObject_TypeCheck(obj.ptr(), sipapi->api_wrapper_type)) {
......
......@@ -146,7 +146,7 @@ Mpl::~Mpl() {
* close
*/
void Mpl::close(const bp::object& figure) throw (Error) {
MplLock lock(__PRETTY_FUNCTION__);
MplLock lock;
// Create matplotlib figure object
auto args = bp::make_tuple(figure);
......@@ -161,7 +161,7 @@ void Mpl::close(const bp::object& figure) throw (Error) {
* xlabel
*/
void Mpl::xlabel(const bp::object& axis, const std::string& name) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
bp::call_method<void, const char *>(axis.ptr(), "set_xlabel", name.c_str());
} catch (...) {
......@@ -173,7 +173,7 @@ void Mpl::xlabel(const bp::object& axis, const std::string& name) throw (Error)
* ylabel
*/
void Mpl::ylabel(const bp::object& axis, const std::string& name) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
bp::call_method<void, const char *>(axis.ptr(), "set_ylabel", name.c_str());
} catch (...) {
......@@ -185,7 +185,7 @@ void Mpl::ylabel(const bp::object& axis, const std::string& name) throw (Error)
* grid
*/
void Mpl::grid(const bp::object& axis, bool show) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
bp::tuple args;
if (show == true) {
args = bp::make_tuple(true);
......@@ -204,7 +204,7 @@ void Mpl::grid(const bp::object& axis, bool show) throw (Error) {
* savefig
*/
void Mpl::savefig(const bp::object& figure, const std::string& filename, uint32 dpi, float64 pad) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
auto args = bp::make_tuple(filename);
bp::dict kwargs;
kwargs["format"] = "png";
......@@ -224,7 +224,7 @@ void Mpl::savefig(const bp::object& figure, const std::string& filename, uint32
* get_xlim
*/
std::pair<float64, float64> Mpl::get_xlim(const bp::object& axis) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
bp::tuple res(axis.attr("get_xlim")());
float64 min = bp::extract<float64>(res[0]);
......@@ -239,7 +239,7 @@ std::pair<float64, float64> Mpl::get_xlim(const bp::object& axis) throw (Error)
* get_ylim
*/
std::pair<float64, float64> Mpl::get_ylim(const bp::object& axis) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
bp::object res = axis.attr("get_ylim")();
float64 min = bp::extract<float64>(res[0]);
......@@ -254,7 +254,7 @@ std::pair<float64, float64> Mpl::get_ylim(const bp::object& axis) throw (Error)
* set_xdata
*/
void Mpl::set_xdata(const bp::object& line, const std::vector<float64> &x) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// using numpy arrays
boost::python::list xarray;
for (float64 val : x) {
......@@ -276,7 +276,7 @@ void Mpl::set_xdata(const bp::object& line, const std::vector<float64> &x) throw
* set_ydata
*/
void Mpl::set_ydata(const bp::object& line, const std::vector<float64> &y) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// using numpy arrays
boost::python::list yarray;
for (float64 val : y) {
......@@ -297,7 +297,7 @@ void Mpl::set_ydata(const bp::object& line, const std::vector<float64> &y) throw
* set_xlim
*/
void Mpl::set_xlim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
float64 tot = max - min;
min -= tot * marge;
max += tot * marge;
......@@ -314,7 +314,7 @@ void Mpl::set_xlim(const bp::object& axis, float64 min, float64 max, float64 mar
* set_ylim
*/
void Mpl::set_ylim(const bp::object& axis, float64 min, float64 max, float64 marge) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
float64 tot = max - min;
min -= tot * marge;
max += tot * marge;
......
......@@ -39,7 +39,7 @@ namespace mpl {
* constructor
*/
MplFigure::MplFigure(Mpl* mpl, bool usetoolbar) : m_Mpl(mpl) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// Get Matplotlib Figure
try {
m_Figure = mpl->getFigureModule().attr("Figure")();
......@@ -64,7 +64,7 @@ MplFigure::MplFigure(Mpl* mpl, bool usetoolbar) : m_Mpl(mpl) {
* destructor
*/
MplFigure::~MplFigure() {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
auto args = bp::make_tuple(m_Figure);
m_Mpl->getPyPlot().attr("close")(*args);
......@@ -81,7 +81,7 @@ MplFigure::~MplFigure() {
* title
*/
void MplFigure::title(const std::string& name) throw (Error) {
MplLock lock(__PRETTY_FUNCTION__);
MplLock lock;
try {
bp::call_method<void, const char *>(m_Figure.ptr(), "suptitle", name.c_str());
......@@ -96,7 +96,7 @@ void MplFigure::title(const std::string& name) throw (Error) {
boost::python::object MplFigure::gridSpec(int32 nrows, int32 ncols, const std::vector<int32>& height_ratios,
const std::vector<int32>& width_ratios, float64 wspace, float64 hspace) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
auto args = bp::make_tuple(nrows, ncols);
bp::dict kwargs;
if (nrows > 1) {
......@@ -128,7 +128,7 @@ boost::python::object MplFigure::gridSpec(int32 nrows, int32 ncols, const std::v
* subplots
*/
bp::object MplFigure::subplots() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// Create matplotlib axis object
bp::object axis;
try {
......@@ -143,7 +143,7 @@ bp::object MplFigure::subplots() throw (Error) {
* subplot
*/
bp::object MplFigure::subplot(const bp::object& gridaxis, const bp::dict& keywords) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// Create matplotlib axis object
auto args = bp::make_tuple(gridaxis);
......@@ -160,7 +160,7 @@ bp::object MplFigure::subplot(const bp::object& gridaxis, const bp::dict& keywor
* delaxis
*/
void MplFigure::delaxes(const bp::object& axis) throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
// delete matplotlib axis object
auto args = bp::make_tuple(axis);
try {
......@@ -174,7 +174,7 @@ void MplFigure::delaxes(const bp::object& axis) throw (Error) {
* draw
*/
void MplFigure::draw() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
m_Canvas.attr("draw")();
} catch (...) {
......@@ -186,7 +186,7 @@ void MplFigure::draw() throw (Error) {
* clear
*/
void MplFigure::clear() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
m_Figure.attr("clf")();
} catch (...) {
......@@ -198,7 +198,7 @@ void MplFigure::clear() throw (Error) {
* resetToolBarStack
*/
void MplFigure::resetToolBarStack() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
m_Toolbar.attr("update")();
} catch (...) {
......@@ -210,7 +210,7 @@ void MplFigure::resetToolBarStack() throw (Error) {
* home
*/
void MplFigure::home() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
m_Toolbar.attr("home")();
} catch (...) {
......@@ -222,7 +222,7 @@ void MplFigure::home() throw (Error) {
* back
*/
void MplFigure::back() throw (Error) {
mpl::MplLock lock(__PRETTY_FUNCTION__);
mpl::MplLock lock;
try {
m_Toolbar.attr("back")();
} catch (...) {
......@@ -234,7 +234,7 @@ void MplFigure::back() throw (Error) {
* zoom
*/
void MplFigure::zoom(bool on) throw (Error) {