Skip to content

Commit a69b64a

Browse files
added cairo_destroy
1 parent 0dff969 commit a69b64a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/callbacks.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <string.h>
2525
#include <stdlib.h>
2626
#include <stdint.h>
27+
#include "cairo.h"
2728
#include "main.h"
2829
#include "input.h"
2930
#include "callbacks.h"
@@ -157,7 +158,6 @@ void on_monitors_changed ( GdkScreen *screen,
157158
}
158159

159160

160-
161161
void on_composited_changed ( GdkScreen *screen,
162162
gpointer user_data)
163163
{
@@ -192,7 +192,6 @@ void on_composited_changed ( GdkScreen *screen,
192192
}
193193

194194

195-
196195
void on_clientapp_selection_get (GtkWidget *widget,
197196
GtkSelectionData *selection_data,
198197
guint info,
@@ -399,9 +398,8 @@ gboolean on_buttonrelease (GtkWidget *win,
399398

400399
gfloat direction = 0;
401400
gint width = 0;
402-
if(devdata->cur_context)
401+
if (devdata->cur_context)
403402
width = devdata->cur_context->arrowsize * devdata->cur_context->width / 2;
404-
405403

406404
if ((ev->x != devdata->lastx) ||
407405
(ev->y != devdata->lasty))
@@ -466,7 +464,6 @@ void on_mainapp_selection_get (GtkWidget *widget,
466464
else
467465
uri = "NOK";
468466

469-
470467
gtk_selection_data_set (selection_data,
471468
gtk_selection_data_get_target(selection_data),
472469
8, (guchar*)uri, strlen (uri));
@@ -549,7 +546,9 @@ void on_mainapp_selection_received (GtkWidget *widget,
549546
g_printerr ("Unable to parse color. "
550547
"Keeping default.\n");
551548
}
552-
GromitPaintContext* line_ctx = paint_context_new(data, GROMIT_PEN, fg_color, thickness, 0, thickness, thickness);
549+
GromitPaintContext* line_ctx =
550+
paint_context_new(data, GROMIT_PEN, fg_color,
551+
thickness, 0, thickness, thickness);
553552

554553
GdkRectangle rect;
555554
rect.x = MIN (startX,endX) - thickness / 2;
@@ -624,6 +623,7 @@ void on_mainapp_selection_received (GtkWidget *widget,
624623
style.width, style.arrowsize,
625624
style.minwidth, style.maxwidth);
626625

626+
cairo_destroy(context->paint_ctx);
627627
g_free(context->paint_color);
628628
*context = *new_context;
629629
g_free(new_context);
@@ -672,7 +672,6 @@ void on_device_added (GdkDeviceManager *device_manager,
672672
}
673673

674674

675-
676675
gboolean on_toggle_paint(GtkWidget *widget,
677676
GdkEventButton *ev,
678677
gpointer user_data)

0 commit comments

Comments
 (0)