forked from AuroraMiddleware/gtk
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...
This commit is contained in:
parent
dd1cf1ac0f
commit
3d5173d4ac
@ -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);
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user