summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_summary.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-10-11 13:36:52 +0200
committerRobin Gareus <robin@gareus.org>2014-10-11 13:36:52 +0200
commite19e6dc73a8dbc93a93354c1d97c39d0f4fa0f0e (patch)
treeb8ec2d607db93fffc15d2a642d8c0964b61c18b1 /gtk2_ardour/editor_summary.cc
parent8ca546ec883191bdbd2825883eca323a68cfea56 (diff)
amend 5d0303b - fix editor summary leak
Diffstat (limited to 'gtk2_ardour/editor_summary.cc')
-rw-r--r--gtk2_ardour/editor_summary.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index 641b060e17..50e9311998 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -62,6 +62,11 @@ EditorSummary::EditorSummary (Editor* e)
set_flags (get_flags() | Gtk::CAN_FOCUS);
}
+EditorSummary::~EditorSummary ()
+{
+ cairo_surface_destroy (_image);
+}
+
/** Handle a size allocation.
* @param alloc GTK allocation.
*/
@@ -102,14 +107,8 @@ EditorSummary::set_session (Session* s)
void
EditorSummary::render_background_image ()
{
- int stride;
- unsigned char *data;
- if (_image) {
- free (cairo_image_surface_get_data (_image));
- }
- stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, get_width ());
- data = (unsigned char*) malloc (stride * get_height ());
- _image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24, get_width (), get_height (), stride);
+ cairo_surface_destroy (_image); // passing NULL is safe
+ _image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, get_width (), get_height ());
cairo_t* cr = cairo_create (_image);