Skip to content

Commit

Permalink
Revert "Fix memory leaks in Gtk backend"
Browse files Browse the repository at this point in the history
The program crashes sometimes with the message: ../cairo/src/cairo-surface.c:962: cairo_surface_destroy: Assertion `CAIRO_REFERENCE_COUNT_HAS_REFERENCE`
  • Loading branch information
simonkrauter committed Nov 3, 2023
1 parent f21bedd commit dba6627
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/nigui/private/gtk3/platform_impl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ method drawText(canvas: Canvas, text: string, x, y = 0) =
cairo_translate(cr, x.float, y.float)
pango_cairo_show_layout(cr, layout)
cairo_restore(cr)
cairo_surface_destroy(layout)

method drawLine(canvas: Canvas, x1, y1, x2, y2: int) =
let cr = cast[CanvasImpl](canvas).fCairoContext
Expand Down Expand Up @@ -700,7 +699,6 @@ method getTextLineWidth(canvas: CanvasImpl, text: string): int {.locks: "unknown
var height: cint
pango_layout_get_pixel_size(layout, width, height)
result = width + 2
cairo_surface_destroy(layout)

method getTextLineHeight(canvas: CanvasImpl): int {.locks: "unknown".} =
if canvas.fCairoContext == nil:
Expand All @@ -714,7 +712,6 @@ method getTextLineHeight(canvas: CanvasImpl): int {.locks: "unknown".} =
var height: cint
pango_layout_get_pixel_size(layout, width, height)
result = height
cairo_surface_destroy(layout)


# ----------------------------------------------------------------------------------------
Expand Down

0 comments on commit dba6627

Please sign in to comment.