[gtk+/wip/otte/rendernode: 70/110] gtk: Fix memleaks
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/rendernode: 70/110] gtk: Fix memleaks
- Date: Mon, 19 Dec 2016 04:50:06 +0000 (UTC)
commit 77117265b63ddb63ae39f160a3ce08be7a9b8926
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 14 00:06:01 2016 +0100
gtk: Fix memleaks
It turns out, some simple getters - such as
gdk_drawing_context_get_clip() - love copying things before returning
them.
I guess somebody has to burn cycles...
gtk/gtkwidget.c | 6 +++++-
gtk/inspector/recorder.c | 5 ++++-
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9b254cf..4d3d24d 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15616,6 +15616,7 @@ gtk_widget_render (GtkWidget *widget,
GtkSnapshot snapshot;
GskRenderer *renderer;
GskRenderNode *root;
+ cairo_region_t *clip;
/* We only render double buffered on native windows */
if (!gdk_window_has_native (window))
@@ -15626,11 +15627,13 @@ gtk_widget_render (GtkWidget *widget,
return;
context = gsk_renderer_begin_draw_frame (renderer, region);
+ clip = gdk_drawing_context_get_clip (context);
gtk_snapshot_init (&snapshot,
renderer,
- gdk_drawing_context_get_clip (context),
+ clip,
"Render<%s>", G_OBJECT_TYPE_NAME (widget));
+ cairo_region_destroy (clip);
gtk_widget_snapshot (widget, &snapshot);
root = gtk_snapshot_finish (&snapshot);
if (root != NULL)
@@ -15646,5 +15649,6 @@ gtk_widget_render (GtkWidget *widget,
gsk_render_node_unref (root);
}
+
gsk_renderer_end_draw_frame (renderer, context);
}
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index bffab83..1a0f5d1 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -461,11 +461,13 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
{
GtkInspectorRecording *recording;
GdkFrameClock *frame_clock;
+ cairo_region_t *clip;
if (!gtk_inspector_recorder_is_recording (recorder))
return;
frame_clock = gtk_widget_get_frame_clock (widget);
+ clip = gdk_drawing_context_get_clip (context);
recording = gtk_inspector_render_recording_new (gdk_frame_clock_get_frame_time (frame_clock),
gsk_renderer_get_profiler (renderer),
@@ -473,10 +475,11 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
gdk_window_get_width (window),
gdk_window_get_height (window) },
region,
- gdk_drawing_context_get_clip (context),
+ clip,
node);
gtk_inspector_recorder_add_recording (recorder, recording);
g_object_unref (recording);
+ cairo_region_destroy (clip);
}
// vim: set et sw=2 ts=2:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]