diff options
author | Thomas White <taw@bitwiz.org.uk> | 2015-02-24 11:44:30 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2015-02-24 11:44:30 +0100 |
commit | 11cf54695fbe47d96325392a4b1323bc16da7032 (patch) | |
tree | f507c1dbc96f0b84599cd567fbb8a7dd1d98715f /src | |
parent | 24e5163fd377e860a62595d01b187be8df1d7a7d (diff) |
Fix a load of memory leaks
Diffstat (limited to 'src')
-rw-r--r-- | src/render.c | 2 | ||||
-rw-r--r-- | src/sc_editor.c | 6 | ||||
-rw-r--r-- | src/slideshow.c | 9 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/render.c b/src/render.c index 37d66e7..4156ed0 100644 --- a/src/render.c +++ b/src/render.c @@ -103,6 +103,8 @@ static void render_callback_box(cairo_t *cr, struct wrap_box *box) cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); cairo_stroke(cr); cairo_restore(cr); + + cairo_surface_destroy(surf); } diff --git a/src/sc_editor.c b/src/sc_editor.c index d261e7c..f2bdbf5 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -244,9 +244,11 @@ void advance_cursor(SCEditor *e) } -static gint destroy_sig(GtkWidget *window, SCEditor *sceditor) +static gint destroy_sig(GtkWidget *window, SCEditor *e) { - /* FIXME: free stuff */ + if ( e->surface != NULL ) { + cairo_surface_destroy(e->surface); + } return 0; } diff --git a/src/slideshow.c b/src/slideshow.c index 1018a71..b156a06 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -1,7 +1,7 @@ /* * slideshow.c * - * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk> + * Copyright © 2013-2015 Thomas White <taw@bitwiz.org.uk> * * This file is part of Colloquium. * @@ -74,6 +74,10 @@ void slideshow_rerender(SlideShow *ss) int n; SCBlock *stylesheets[2]; + if ( ss->surface != NULL ) { + cairo_surface_destroy(ss->surface); + } + stylesheets[0] = ss->p->stylesheet; stylesheets[1] = NULL; @@ -90,6 +94,9 @@ static gint ss_destroy_sig(GtkWidget *widget, SlideShow *ss) g_object_unref(ss->blank_cursor); slidewindow_slideshow_ended(ss->slide_window); slidewindow_redraw(ss->slide_window); + if ( ss->surface != NULL ) { + cairo_surface_destroy(ss->surface); + } free(ss); return FALSE; } |