Skip to content

Commit

Permalink
appwindow: $dispose() cairo context in draw handler
Browse files Browse the repository at this point in the history
Properly fixes #20
  • Loading branch information
amezin committed Jan 27, 2021
1 parent 5cbe80a commit 38b3884
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions appwindow.js
Expand Up @@ -189,16 +189,21 @@ var AppWindow = GObject.registerClass(
}

draw(_widget, cr) {
if (!this.app_paintable)
return false;
try {
if (!this.app_paintable)
return false;

if (!Gtk.cairo_should_draw_window(cr, this.window))
return false;
if (!Gtk.cairo_should_draw_window(cr, this.window))
return false;

const context = this.get_style_context();
const allocation = this.get_child().get_allocation();
Gtk.render_background(context, cr, allocation.x, allocation.y, allocation.width, allocation.height);
Gtk.render_frame(context, cr, allocation.x, allocation.y, allocation.width, allocation.height);
const context = this.get_style_context();
const allocation = this.get_child().get_allocation();
Gtk.render_background(context, cr, allocation.x, allocation.y, allocation.width, allocation.height);
Gtk.render_frame(context, cr, allocation.x, allocation.y, allocation.width, allocation.height);

} finally {
cr.$dispose();
}

return false;
}
Expand Down

0 comments on commit 38b3884

Please sign in to comment.