[libhandy/msvc: 23/26] src/: Remove g_auto*()
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/msvc: 23/26] src/: Remove g_auto*()
- Date: Fri, 21 Jan 2022 09:51:35 +0000 (UTC)
commit 1ee89ecf38c84fda89c70fa687bce0400fc2fc1a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jan 19 16:14:54 2022 +0800
src/: Remove g_auto*()
g_auto*() macros are unfortunately GCCism's that don't work on Visual Studio,
so drop them, so that things build on Visual Studio.
src/gtk-window.c | 19 ++-
src/hdy-avatar-icon.c | 35 +++---
src/hdy-avatar.c | 240 +++++++++++++++++++++++--------------
src/hdy-carousel-box.c | 12 +-
src/hdy-carousel-indicator-dots.c | 26 ++--
src/hdy-carousel-indicator-lines.c | 28 +++--
src/hdy-combo-row.c | 60 ++++++----
src/hdy-expander-row.c | 4 +-
src/hdy-header-bar.c | 4 +-
src/hdy-header-group.c | 22 +++-
src/hdy-keypad-button.c | 4 +-
src/hdy-keypad.c | 21 ++--
src/hdy-main.c | 16 ++-
src/hdy-preferences-group.c | 4 +-
src/hdy-preferences-window.c | 43 ++++---
src/hdy-settings.c | 18 ++-
src/hdy-shadow-helper.c | 23 ++--
src/hdy-squeezer.c | 4 +-
src/hdy-stackable-box.c | 8 +-
src/hdy-style-manager.c | 69 +++++++----
src/hdy-swipe-tracker.c | 61 ++++++----
src/hdy-tab-view.c | 8 +-
src/hdy-value-object.c | 34 ++++--
src/hdy-view-switcher.c | 26 ++--
src/hdy-window-handle-controller.c | 41 +++----
src/hdy-window-mixin.c | 15 ++-
26 files changed, 532 insertions(+), 313 deletions(-)
---
diff --git a/src/gtk-window.c b/src/gtk-window.c
index 154acdbe..97df0a17 100644
--- a/src/gtk-window.c
+++ b/src/gtk-window.c
@@ -133,7 +133,8 @@ hdy_gtk_window_get_icon_for_size (GtkWindow *window,
{
GtkWindowIconInfo *info;
const gchar *name;
- g_autoptr (GList) default_icon_list = gtk_window_get_default_icon_list ();
+ GList *default_icon_list;
+ GdkPixbuf *result;
info = ensure_icon_info (window);
@@ -151,13 +152,19 @@ hdy_gtk_window_get_icon_for_size (GtkWindow *window,
return icon_from_list (info->icon_list, size);
}
- if (default_icon_list != NULL)
- return icon_from_list (default_icon_list, size);
+ default_icon_list = gtk_window_get_default_icon_list ();
- if (gtk_window_get_default_icon_name () != NULL)
- return icon_from_name (gtk_window_get_default_icon_name (), size);
+ if (default_icon_list != NULL) {
+ result = icon_from_list (default_icon_list, size);
+ } else if (gtk_window_get_default_icon_name () != NULL) {
+ result = icon_from_name (gtk_window_get_default_icon_name (), size);
+ } else {
+ result = NULL;
+ }
- return NULL;
+ g_list_free (default_icon_list);
+
+ return result;
}
GdkWindowState
diff --git a/src/hdy-avatar-icon.c b/src/hdy-avatar-icon.c
index 8d8c883d..545beeb9 100644
--- a/src/hdy-avatar-icon.c
+++ b/src/hdy-avatar-icon.c
@@ -78,22 +78,19 @@ load_pixbuf_cb (GObject *source_object,
GAsyncResult *res,
gpointer data)
{
- g_autoptr (GTask) task = G_TASK (data);
- g_autoptr (GError) error = NULL;
- g_autoptr (GInputStream) stream = NULL;
+ GTask *task = G_TASK (data);
+ GError *error = NULL;
- if (g_task_return_error_if_cancelled (task))
- return;
+ if (!g_task_return_error_if_cancelled (task)) {
+ GInputStream *stream = g_loadable_icon_load_finish (G_LOADABLE_ICON (source_object), res, NULL, &error);
- stream = g_loadable_icon_load_finish (G_LOADABLE_ICON (source_object), res, NULL, &error);
-
- if (stream == NULL) {
- g_task_return_error (task, g_steal_pointer (&error));
-
- return;
+ if (stream == NULL)
+ g_task_return_error (task, error);
+ else
+ g_task_return_pointer (task, stream, g_object_unref);
}
- g_task_return_pointer (task, g_steal_pointer (&stream), g_object_unref);
+ g_object_unref (task);
}
static void
@@ -104,8 +101,8 @@ hdy_avatar_icon_load_async (GLoadableIcon *icon,
gpointer user_data)
{
HdyAvatarIcon *self;
- g_autoptr (GTask) task = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ GTask *task;
+ GdkPixbuf *pixbuf;
g_return_if_fail (HDY_IS_AVATAR_ICON (icon));
self = HDY_AVATAR_ICON (icon);
@@ -118,18 +115,20 @@ hdy_avatar_icon_load_async (GLoadableIcon *icon,
if (self->load_image_func)
pixbuf = self->load_image_func (size, self->load_image_func_target);
- if (pixbuf) {
+ if (pixbuf)
g_loadable_icon_load_async (G_LOADABLE_ICON (pixbuf),
size,
cancellable,
load_pixbuf_cb,
- g_steal_pointer (&task));
- } else {
+ task);
+ else
g_task_return_new_error (task,
HDY_AVATAR_ICON_ERROR,
HDY_AVATAR_ICON_ERROR_EMPTY,
"No pixbuf set");
- }
+
+ g_object_unref (pixbuf);
+ g_object_unref (task);
}
static GInputStream *
diff --git a/src/hdy-avatar.c b/src/hdy-avatar.c
index 3a022733..e1cdab37 100644
--- a/src/hdy-avatar.c
+++ b/src/hdy-avatar.c
@@ -110,10 +110,11 @@ static GdkPixbuf *
make_round_image (GdkPixbuf *pixbuf,
gdouble size)
{
- g_autoptr (cairo_surface_t) surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
- g_autoptr (cairo_t) cr = cairo_create (surface);
+ cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
+ cairo_t *cr = cairo_create (surface);
gint width = gdk_pixbuf_get_width (pixbuf);
gint height = gdk_pixbuf_get_height (pixbuf);
+ GdkPixbuf *resulting_pixbuf;
/* Clip a circle */
cairo_arc (cr, size / 2.0, size / 2.0, size / 2.0, 0, 2 * G_PI);
@@ -123,35 +124,47 @@ make_round_image (GdkPixbuf *pixbuf,
gdk_cairo_set_source_pixbuf (cr, pixbuf, (size - width) / 2, (size - height) / 2);
cairo_paint (cr);
- return gdk_pixbuf_get_from_surface (surface, 0, 0, size, size);
+ resulting_pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, size, size);
+
+ cairo_surface_destroy (surface);
+ cairo_destroy (cr);
+
+ return resulting_pixbuf;
}
static gchar *
extract_initials_from_text (const gchar *text)
{
GString *initials;
- g_autofree gchar *p = g_utf8_strup (text, -1);
- g_autofree gchar *normalized = g_utf8_normalize (g_strstrip (p), -1, G_NORMALIZE_DEFAULT_COMPOSE);
+ gchar *p = g_utf8_strup (text, -1);
+ gchar *normalized = g_utf8_normalize (g_strstrip (p), -1, G_NORMALIZE_DEFAULT_COMPOSE);
gunichar unichar;
gchar *q = NULL;
+ gchar *result;
- if (normalized == NULL)
- return NULL;
+ if (normalized != NULL) {
+ initials = g_string_new ("");
- initials = g_string_new ("");
+ unichar = g_utf8_get_char (normalized);
+ g_string_append_unichar (initials, unichar);
- unichar = g_utf8_get_char (normalized);
- g_string_append_unichar (initials, unichar);
+ q = g_utf8_strrchr (normalized, -1, ' ');
+ if (q != NULL && g_utf8_next_char (q) != NULL) {
+ q = g_utf8_next_char (q);
- q = g_utf8_strrchr (normalized, -1, ' ');
- if (q != NULL && g_utf8_next_char (q) != NULL) {
- q = g_utf8_next_char (q);
+ unichar = g_utf8_get_char (q);
+ g_string_append_unichar (initials, unichar);
+ }
- unichar = g_utf8_get_char (q);
- g_string_append_unichar (initials, unichar);
+ result = g_string_free (initials, FALSE);
+ } else {
+ result = NULL;
}
- return g_string_free (initials, FALSE);
+ g_free (normalized);
+ g_free (p);
+
+ return result;
}
static GdkPixbuf *
@@ -214,49 +227,42 @@ load_from_stream_async_cb (GObject *stream,
GAsyncResult *res,
gpointer data)
{
- g_autoptr (GTask) task = data;
+ GTask *task = data;
GdkPixbufLoader *loader = g_task_get_task_data (task);
- g_autoptr (GBytes) bytes = NULL;
+ GBytes *bytes;
GError *error = NULL;
bytes = g_input_stream_read_bytes_finish (G_INPUT_STREAM (stream), res, &error);
+
if (bytes == NULL) {
gdk_pixbuf_loader_close (loader, NULL);
g_task_return_error (task, error);
-
- return;
- }
-
- if (g_bytes_get_size (bytes) == 0) {
- if (!gdk_pixbuf_loader_close (loader, &error)) {
+ } else if (g_bytes_get_size (bytes) != 0) {
+ if (!gdk_pixbuf_loader_write (loader,
+ g_bytes_get_data (bytes, NULL),
+ g_bytes_get_size (bytes),
+ &error)) {
+ gdk_pixbuf_loader_close (loader, NULL);
g_task_return_error (task, error);
-
- return;
+ } else {
+ g_input_stream_read_bytes_async (G_INPUT_STREAM (stream),
+ LOAD_BUFFER_SIZE,
+ G_PRIORITY_DEFAULT,
+ g_task_get_cancellable (task),
+ load_from_stream_async_cb,
+ g_object_ref (task));
}
-
- g_task_return_pointer (task,
- g_object_ref (gdk_pixbuf_loader_get_pixbuf (loader)),
- g_object_unref);
-
- return;
- }
-
- if (!gdk_pixbuf_loader_write (loader,
- g_bytes_get_data (bytes, NULL),
- g_bytes_get_size (bytes),
- &error)) {
- gdk_pixbuf_loader_close (loader, NULL);
- g_task_return_error (task, error);
-
- return;
+ } else {
+ if (!gdk_pixbuf_loader_close (loader, &error))
+ g_task_return_error (task, error);
+ else
+ g_task_return_pointer (task,
+ g_object_ref (gdk_pixbuf_loader_get_pixbuf (loader)),
+ g_object_unref);
}
- g_input_stream_read_bytes_async (G_INPUT_STREAM (stream),
- LOAD_BUFFER_SIZE,
- G_PRIORITY_DEFAULT,
- g_task_get_cancellable (task),
- load_from_stream_async_cb,
- g_object_ref (task));
+ g_bytes_unref (bytes);
+ g_object_unref (task);
}
static void
@@ -265,13 +271,14 @@ icon_load_async_cb (GLoadableIcon *icon,
GTask *task)
{
GdkPixbufLoader *loader = g_task_get_task_data (task);
- g_autoptr (GInputStream) stream = NULL;
- g_autoptr (GError) error = NULL;
+ GInputStream *stream;
+ GError *error = NULL;
stream = g_loadable_icon_load_finish (icon, res, NULL, &error);
if (stream == NULL) {
gdk_pixbuf_loader_close (loader, NULL);
- g_task_return_error (task, g_steal_pointer (&error));
+ g_task_return_error (task, error);
+
g_object_unref (task);
return;
@@ -283,6 +290,8 @@ icon_load_async_cb (GLoadableIcon *icon,
g_task_get_cancellable (task),
load_from_stream_async_cb,
task);
+
+ g_object_unref (stream);
}
static GdkPixbuf *
@@ -299,8 +308,8 @@ load_from_gicon_async_for_display_cb (HdyAvatar *self,
GAsyncResult *res,
gpointer *user_data)
{
- g_autoptr (GError) error = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ GError *error = NULL;
+ GdkPixbuf *pixbuf;
pixbuf = load_from_gicon_async_finish (res, &error);
@@ -316,7 +325,7 @@ load_from_gicon_async_for_display_cb (HdyAvatar *self,
self->currently_loading_size = -1;
if (pixbuf) {
- g_autoptr (GdkPixbuf) custom_image = NULL;
+ GdkPixbuf *custom_image;
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
gint width = gtk_widget_get_allocated_width (GTK_WIDGET (self));
gint height = gtk_widget_get_allocated_height (GTK_WIDGET (self));
@@ -334,7 +343,12 @@ load_from_gicon_async_for_display_cb (HdyAvatar *self,
g_set_object (&self->round_image, custom_image);
gtk_widget_queue_draw (GTK_WIDGET (self));
+
+ g_object_unref (custom_image);
}
+
+ g_object_unref (pixbuf);
+ g_clear_error (&error);
}
static void
@@ -343,8 +357,8 @@ load_from_gicon_async_for_export_cb (HdyAvatar *self,
gpointer *user_data)
{
GTask *task = G_TASK (user_data);
- g_autoptr (GError) error = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ GError *error = NULL;
+ GdkPixbuf *pixbuf;
pixbuf = load_from_gicon_async_finish (res, &error);
@@ -352,10 +366,12 @@ load_from_gicon_async_for_export_cb (HdyAvatar *self,
!g_error_matches (error, HDY_AVATAR_ICON_ERROR, HDY_AVATAR_ICON_ERROR_EMPTY) &&
!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_warning ("Failed to load icon: %s", error->message);
+
+ g_clear_error (&error);
}
g_task_return_pointer (task,
- g_steal_pointer (&pixbuf),
+ pixbuf,
g_object_unref);
g_object_unref (task);
}
@@ -430,10 +446,10 @@ static GdkPixbuf *
load_icon_sync (GLoadableIcon *icon,
gint size)
{
- g_autoptr (GError) error = NULL;
- g_autoptr (GInputStream) stream = g_loadable_icon_load (icon, size, NULL, NULL, &error);
- g_autoptr (GdkPixbufLoader) loader = gdk_pixbuf_loader_new ();
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ GError *error = NULL;
+ GInputStream *stream = g_loadable_icon_load (icon, size, NULL, NULL, &error);
+ GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
+ GdkPixbuf *pixbuf;
if (error) {
g_warning ("Failed to load icon: %s", error->message);
@@ -446,34 +462,40 @@ load_icon_sync (GLoadableIcon *icon,
pixbuf = load_from_stream (loader, stream, NULL, &error);
- if (error) {
+ if (error)
g_warning ("Failed to load pixbuf from GLoadableIcon: %s", error->message);
- return NULL;
- }
- return g_steal_pointer (&pixbuf);
+ g_clear_error (&error);
+ g_object_unref (loader);
+ g_object_unref (stream);
+
+ return pixbuf;
}
static void
set_class_color (HdyAvatar *self)
{
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
- g_autofree GRand *rand = NULL;
- g_autofree gchar *new_class = NULL;
- g_autofree gchar *old_class = g_strdup_printf ("color%d", self->color_class);
+ gchar *new_class;
+ gchar *old_class = g_strdup_printf ("color%d", self->color_class);
gtk_style_context_remove_class (context, old_class);
if (self->text == NULL || strlen (self->text) == 0) {
/* Use a random color if we don't have a text */
- rand = g_rand_new ();
+ GRand *rand = g_rand_new ();
self->color_class = g_rand_int_range (rand, 1, NUMBER_OF_COLORS);
+
+ g_free (rand);
} else {
self->color_class = (g_str_hash (self->text) % NUMBER_OF_COLORS) + 1;
}
new_class = g_strdup_printf ("color%d", self->color_class);
gtk_style_context_add_class (context, new_class);
+
+ g_free (new_class);
+ g_free (old_class);
}
static void
@@ -497,13 +519,15 @@ clear_pango_layout (HdyAvatar *self)
static void
ensure_pango_layout (HdyAvatar *self)
{
- g_autofree gchar *initials = NULL;
+ gchar *initials;
if (self->layout != NULL || self->text == NULL || strlen (self->text) == 0)
return;
initials = extract_initials_from_text (self->text);
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), initials);
+
+ g_free (initials);
}
static void
@@ -655,10 +679,10 @@ draw_for_size (HdyAvatar *self,
gdouble y = (gdouble)(height - size) / 2.0;
const gchar *icon_name;
GdkRGBA color;
- g_autoptr (GtkIconInfo) icon = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
- g_autoptr (GError) error = NULL;
- g_autoptr (cairo_surface_t) surface = NULL;
+ GtkIconInfo *icon;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
+ cairo_surface_t *surface;
set_class_contrasted (self, size);
@@ -668,6 +692,9 @@ draw_for_size (HdyAvatar *self,
gtk_render_icon_surface (context, cr, surface, x, y);
gtk_render_background (context, cr, x, y, size, size);
gtk_render_frame (context, cr, x, y, size, size);
+
+ cairo_surface_destroy (surface);
+
return;
}
@@ -702,6 +729,10 @@ draw_for_size (HdyAvatar *self,
pixbuf = gtk_icon_info_load_symbolic (icon, &color, NULL, NULL, NULL, NULL, &error);
if (error != NULL) {
g_critical ("Failed to load icon `%s': %s", icon_name, error->message);
+
+ g_object_unref (icon);
+ g_clear_error (&error);
+
return;
}
@@ -713,6 +744,10 @@ draw_for_size (HdyAvatar *self,
gtk_render_icon_surface (context, cr, surface,
(((gdouble) size - ((gdouble) width / (gdouble) scale_factor)) / 2.0) + x,
(((gdouble) size - ((gdouble) height / (gdouble) scale_factor)) / 2.0) + y);
+
+ g_object_unref (icon);
+ g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
static gboolean
@@ -1119,7 +1154,7 @@ hdy_avatar_set_image_load_func (HdyAvatar *self,
gpointer user_data,
GDestroyNotify destroy)
{
- g_autoptr (HdyAvatarIcon) icon = NULL;
+ HdyAvatarIcon *icon = NULL;
g_return_if_fail (HDY_IS_AVATAR (self));
g_return_if_fail (user_data != NULL || (user_data == NULL && destroy == NULL));
@@ -1136,6 +1171,8 @@ hdy_avatar_set_image_load_func (HdyAvatar *self,
g_set_object (&self->load_func_icon, icon);
+ g_object_unref (icon);
+
/* Don't update the custom avatar when we have a user set GLoadableIcon */
if (self->icon)
return;
@@ -1211,10 +1248,9 @@ hdy_avatar_draw_to_pixbuf (HdyAvatar *self,
gint size,
gint scale_factor)
{
- g_autoptr (cairo_surface_t) surface = NULL;
- g_autoptr (cairo_t) cr = NULL;
- g_autoptr (GdkPixbuf) custom_image = NULL;
- g_autoptr (GdkPixbuf) pixbuf_from_icon = NULL;
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ GdkPixbuf *custom_image, *pixbuf_from_icon, *result;
gint scaled_size = size * scale_factor;
GtkStyleContext *context;
GtkAllocation bounds;
@@ -1249,9 +1285,17 @@ hdy_avatar_draw_to_pixbuf (HdyAvatar *self,
draw_for_size (self, cr, custom_image, size, size, scale_factor);
- return gdk_pixbuf_get_from_surface (surface, 0, 0,
- bounds.width * scale_factor,
- bounds.height * scale_factor);
+ g_object_unref (custom_image);
+ g_object_unref (pixbuf_from_icon);
+ cairo_destroy (cr);
+
+ result = gdk_pixbuf_get_from_surface (surface, 0, 0,
+ bounds.width * scale_factor,
+ bounds.height * scale_factor);
+
+ g_object_unref (surface);
+
+ return result;
}
/**
@@ -1276,7 +1320,7 @@ hdy_avatar_draw_to_pixbuf_async (HdyAvatar *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_autoptr (GTask) task = NULL;
+ GTask *task = NULL;
gint scaled_size = size * scale_factor;
SizeData *data;
@@ -1295,14 +1339,17 @@ hdy_avatar_draw_to_pixbuf_async (HdyAvatar *self,
if (get_icon (self) &&
(!self->round_image ||
gdk_pixbuf_get_width (self->round_image) != scaled_size ||
- is_scaled (self->round_image)))
+ is_scaled (self->round_image))) {
load_icon_async (self,
scaled_size,
cancellable,
(GAsyncReadyCallback) load_from_gicon_async_for_export_cb,
- g_steal_pointer (&task));
- else
+ task);
+ } else {
g_task_return_pointer (task, NULL, NULL);
+
+ g_object_unref (task);
+ }
}
/**
@@ -1321,13 +1368,14 @@ hdy_avatar_draw_to_pixbuf_finish (HdyAvatar *self,
GAsyncResult *async_result)
{
GTask *task;
- g_autoptr (GdkPixbuf) pixbuf_from_icon = NULL;
- g_autoptr (GdkPixbuf) custom_image = NULL;
- g_autoptr (cairo_surface_t) surface = NULL;
- g_autoptr (cairo_t) cr = NULL;
+ GdkPixbuf *pixbuf_from_icon = NULL;
+ GdkPixbuf *custom_image = NULL;
+ cairo_surface_t *surface = NULL;
+ cairo_t *cr = NULL;
SizeData *data;
GtkStyleContext *context;
GtkAllocation bounds;
+ GdkPixbuf *result_pixbuf;
g_return_val_if_fail (G_IS_TASK (async_result), NULL);
@@ -1354,9 +1402,15 @@ hdy_avatar_draw_to_pixbuf_finish (HdyAvatar *self,
data->size * data->scale_factor);
draw_for_size (self, cr, custom_image, data->size, data->size, data->scale_factor);
- return gdk_pixbuf_get_from_surface (surface, 0, 0,
- bounds.width * data->scale_factor,
- bounds.height * data->scale_factor);
+
+ result_pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
+ bounds.width * data->scale_factor,
+ bounds.height * data->scale_factor);
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
+ return result_pixbuf;
}
/**
diff --git a/src/hdy-carousel-box.c b/src/hdy-carousel-box.c
index d3aab027..3d64398a 100644
--- a/src/hdy-carousel-box.c
+++ b/src/hdy-carousel-box.c
@@ -435,7 +435,7 @@ animation_cb (GtkWidget *widget,
gpointer user_data)
{
HdyCarouselBox *self = HDY_CAROUSEL_BOX (widget);
- g_autoptr (GList) children = NULL;
+ GList *children;
GList *l;
gboolean should_continue;
gdouble position_shift;
@@ -473,6 +473,8 @@ animation_cb (GtkWidget *widget,
if (!should_continue)
self->tick_cb_id = 0;
+ g_list_free (children);
+
return should_continue;
}
@@ -571,7 +573,7 @@ hdy_carousel_box_draw (GtkWidget *widget,
continue;
if (info->dirty_region && !info->removing) {
- g_autoptr (cairo_t) surface_cr = NULL;
+ cairo_t *surface_cr;
GtkAllocation child_alloc;
if (!info->surface) {
@@ -607,6 +609,8 @@ hdy_carousel_box_draw (GtkWidget *widget,
cairo_region_destroy (info->dirty_region);
info->dirty_region = NULL;
+
+ cairo_destroy (surface_cr);
}
if (!info->surface)
@@ -962,7 +966,7 @@ hdy_carousel_box_forall (GtkContainer *container,
gpointer callback_data)
{
HdyCarouselBox *self = HDY_CAROUSEL_BOX (container);
- g_autoptr (GList) children = NULL;
+ GList *children;
GList *l;
children = g_list_copy (self->children);
@@ -972,6 +976,8 @@ hdy_carousel_box_forall (GtkContainer *container,
if (!child->removing)
(* callback) (child->widget, callback_data);
}
+
+ g_list_free (children);
}
static void
diff --git a/src/hdy-carousel-indicator-dots.c b/src/hdy-carousel-indicator-dots.c
index 5bbc5417..87ea6640 100644
--- a/src/hdy-carousel-indicator-dots.c
+++ b/src/hdy-carousel-indicator-dots.c
@@ -278,8 +278,8 @@ hdy_carousel_indicator_dots_draw (GtkWidget *widget,
HdyCarouselIndicatorDots *self = HDY_CAROUSEL_INDICATOR_DOTS (widget);
gint i, n_points;
gdouble position;
- g_autofree gdouble *points = NULL;
- g_autofree gdouble *sizes = NULL;
+ gdouble *points;
+ gdouble *sizes = NULL;
if (!self->carousel)
return GDK_EVENT_PROPAGATE;
@@ -287,20 +287,22 @@ hdy_carousel_indicator_dots_draw (GtkWidget *widget,
points = hdy_swipeable_get_snap_points (HDY_SWIPEABLE (self->carousel), &n_points);
position = hdy_carousel_get_position (self->carousel);
- if (n_points < 2)
- return GDK_EVENT_PROPAGATE;
+ if (n_points >= 2) {
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL &&
+ gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ position = points[n_points - 1] - position;
- if (self->orientation == GTK_ORIENTATION_HORIZONTAL &&
- gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- position = points[n_points - 1] - position;
+ sizes = g_new0 (gdouble, n_points);
- sizes = g_new0 (gdouble, n_points);
+ sizes[0] = points[0] + 1;
+ for (i = 1; i < n_points; i++)
+ sizes[i] = points[i] - points[i - 1];
- sizes[0] = points[0] + 1;
- for (i = 1; i < n_points; i++)
- sizes[i] = points[i] - points[i - 1];
+ draw_dots (widget, cr, self->orientation, position, sizes, n_points);
+ }
- draw_dots (widget, cr, self->orientation, position, sizes, n_points);
+ g_free (sizes);
+ g_free (points);
return GDK_EVENT_PROPAGATE;
}
diff --git a/src/hdy-carousel-indicator-lines.c b/src/hdy-carousel-indicator-lines.c
index fba9b380..12b4781b 100644
--- a/src/hdy-carousel-indicator-lines.c
+++ b/src/hdy-carousel-indicator-lines.c
@@ -277,8 +277,8 @@ hdy_carousel_indicator_lines_draw (GtkWidget *widget,
HdyCarouselIndicatorLines *self = HDY_CAROUSEL_INDICATOR_LINES (widget);
gint i, n_points;
gdouble position;
- g_autofree gdouble *points = NULL;
- g_autofree gdouble *sizes = NULL;
+ gdouble *points;
+ gdouble *sizes = NULL;
if (!self->carousel)
return GDK_EVENT_PROPAGATE;
@@ -286,21 +286,23 @@ hdy_carousel_indicator_lines_draw (GtkWidget *widget,
points = hdy_swipeable_get_snap_points (HDY_SWIPEABLE (self->carousel), &n_points);
position = hdy_carousel_get_position (self->carousel);
- if (n_points < 2)
- return GDK_EVENT_PROPAGATE;
-
- if (self->orientation == GTK_ORIENTATION_HORIZONTAL &&
- gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- position = points[n_points - 1] - position;
+ if (n_points >= 2) {
+ if (self->orientation == GTK_ORIENTATION_HORIZONTAL &&
+ gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ position = points[n_points - 1] - position;
- sizes = g_new0 (gdouble, n_points);
+ sizes = g_new0 (gdouble, n_points);
- sizes[0] = points[0] + 1;
- for (i = 1; i < n_points; i++)
- sizes[i] = points[i] - points[i - 1];
+ sizes[0] = points[0] + 1;
+ for (i = 1; i < n_points; i++)
+ sizes[i] = points[i] - points[i - 1];
- draw_lines (widget, cr, self->orientation, position, sizes, n_points);
+ draw_lines (widget, cr, self->orientation, position, sizes, n_points);
+ }
+ g_free (sizes);
+ g_free (points);
+
return GDK_EVENT_PROPAGATE;
}
diff --git a/src/hdy-combo-row.c b/src/hdy-combo-row.c
index a0597634..133676e7 100644
--- a/src/hdy-combo-row.c
+++ b/src/hdy-combo-row.c
@@ -86,16 +86,19 @@ create_list_label (gpointer item,
gpointer user_data)
{
HdyComboRowGetName *get_name = (HdyComboRowGetName *) user_data;
- g_autofree gchar *name = get_name->func (item, get_name->func_data);
-
- return g_object_new (GTK_TYPE_LABEL,
- "ellipsize", PANGO_ELLIPSIZE_END,
- "label", name,
- "max-width-chars", 20,
- "valign", GTK_ALIGN_CENTER,
- "visible", TRUE,
- "xalign", 0.0,
- NULL);
+ gchar *name = get_name->func (item, get_name->func_data);
+ GtkWidget *widget = g_object_new (GTK_TYPE_LABEL,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "label", name,
+ "max-width-chars", 20,
+ "valign", GTK_ALIGN_CENTER,
+ "visible", TRUE,
+ "xalign", 0.0,
+ NULL);
+
+ g_free (name);
+
+ return widget;
}
static GtkWidget *
@@ -103,19 +106,24 @@ create_current_label (gpointer item,
gpointer user_data)
{
HdyComboRowGetName *get_name = (HdyComboRowGetName *) user_data;
- g_autofree gchar *name = NULL;
+ gchar *name = NULL;
+ GtkWidget *widget;
if (get_name->func)
name = get_name->func (item, get_name->func_data);
- return g_object_new (GTK_TYPE_LABEL,
- "ellipsize", PANGO_ELLIPSIZE_END,
- "halign", GTK_ALIGN_END,
- "label", name,
- "valign", GTK_ALIGN_CENTER,
- "visible", TRUE,
- "xalign", 0.0,
- NULL);
+ widget = g_object_new (GTK_TYPE_LABEL,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "halign", GTK_ALIGN_END,
+ "label", name,
+ "valign", GTK_ALIGN_CENTER,
+ "visible", TRUE,
+ "xalign", 0.0,
+ NULL);
+
+ g_free (name);
+
+ return widget;
}
static void
@@ -177,8 +185,8 @@ static void
update (HdyComboRow *self)
{
HdyComboRowPrivate *priv = hdy_combo_row_get_instance_private (self);
- g_autoptr(GObject) item = NULL;
- g_autofree gchar *name = NULL;
+ GObject *item;
+ gchar *name = NULL;
GtkWidget *widget;
guint n_items = priv->bound_model ? g_list_model_get_n_items (priv->bound_model) : 0;
gint i;
@@ -218,6 +226,9 @@ update (HdyComboRow *self)
widget = priv->create_current_widget_func (item, priv->create_widget_func_data);
gtk_container_add (GTK_CONTAINER (priv->current), widget);
}
+
+ g_free (name);
+ g_object_unref (item);
}
static void
@@ -651,7 +662,7 @@ hdy_combo_row_set_for_enum (HdyComboRow *self,
gpointer user_data,
GDestroyNotify user_data_free_func)
{
- g_autoptr (GListStore) store = g_list_store_new (HDY_TYPE_ENUM_VALUE_OBJECT);
+ GListStore *store = g_list_store_new (HDY_TYPE_ENUM_VALUE_OBJECT);
/* g_autoptr for GEnumClass would require glib > 2.56 */
GEnumClass *enum_class = NULL;
gsize i;
@@ -661,13 +672,16 @@ hdy_combo_row_set_for_enum (HdyComboRow *self,
enum_class = g_type_class_ref (enum_type);
for (i = 0; i < enum_class->n_values; i++)
{
- g_autoptr(HdyEnumValueObject) obj = hdy_enum_value_object_new (&enum_class->values[i]);
+ HdyEnumValueObject *obj = hdy_enum_value_object_new (&enum_class->values[i]);
g_list_store_append (store, obj);
+
+ g_object_unref (obj);
}
hdy_combo_row_bind_name_model (self, G_LIST_MODEL (store), (HdyComboRowGetNameFunc) get_name_func,
user_data, user_data_free_func);
g_type_class_unref (enum_class);
+ g_object_unref (store);
}
/**
diff --git a/src/hdy-expander-row.c b/src/hdy-expander-row.c
index 55bf6952..d254112c 100644
--- a/src/hdy-expander-row.c
+++ b/src/hdy-expander-row.c
@@ -84,13 +84,15 @@ update_arrow (HdyExpanderRow *self)
GtkWidget *previous_sibling = NULL;
if (parent) {
- g_autoptr (GList) siblings = gtk_container_get_children (GTK_CONTAINER (parent));
+ GList *siblings = gtk_container_get_children (GTK_CONTAINER (parent));
GList *l;
for (l = siblings; l != NULL && l->next != NULL && l->next->data != self; l = l->next);
if (l && l->next && l->next->data == self)
previous_sibling = l->data;
+
+ g_list_free (siblings);
}
if (priv->expanded)
diff --git a/src/hdy-header-bar.c b/src/hdy-header-bar.c
index e07f31a8..619b7ade 100644
--- a/src/hdy-header-bar.c
+++ b/src/hdy-header-bar.c
@@ -328,13 +328,15 @@ hdy_header_bar_update_window_icon (HdyHeaderBar *self,
pixbuf = hdy_gtk_window_get_icon_for_size (window, scale * 20);
if (pixbuf) {
- g_autoptr (cairo_surface_t) surface =
+ cairo_surface_t *surface =
gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, gtk_widget_get_window (priv->titlebar_icon));
gtk_image_set_from_surface (GTK_IMAGE (priv->titlebar_icon), surface);
g_object_unref (pixbuf);
gtk_widget_show (priv->titlebar_icon);
+ cairo_surface_destroy (surface);
+
return TRUE;
}
diff --git a/src/hdy-header-group.c b/src/hdy-header-group.c
index cb99c7ae..ab4c202f 100644
--- a/src/hdy-header-group.c
+++ b/src/hdy-header-group.c
@@ -324,10 +324,10 @@ update_decoration_layouts (HdyHeaderGroup *self)
GSList *children;
GtkSettings *settings;
HdyHeaderGroupChild *start_child = NULL, *end_child = NULL;
- g_autofree gchar *layout = NULL;
- g_autofree gchar *start_layout = NULL;
- g_autofree gchar *end_layout = NULL;
- g_auto(GStrv) ends = NULL;
+ gchar *layout;
+ gchar *start_layout = NULL;
+ gchar *end_layout = NULL;
+ GStrv ends;
g_return_if_fail (HDY_IS_HEADER_GROUP (self));
@@ -348,6 +348,8 @@ update_decoration_layouts (HdyHeaderGroup *self)
for (; children != NULL; children = children->next)
hdy_header_group_child_set_decoration_layout (HDY_HEADER_GROUP_CHILD (children->data), layout);
+ g_free (layout);
+
return;
}
@@ -365,12 +367,17 @@ update_decoration_layouts (HdyHeaderGroup *self)
end_child = child;
}
- if (start_child == NULL || end_child == NULL)
+ if (start_child == NULL || end_child == NULL) {
+ g_free (layout);
+
return;
+ }
if (start_child == end_child) {
hdy_header_group_child_set_decoration_layout (start_child, layout);
+ g_free (layout);
+
return;
}
@@ -384,6 +391,11 @@ update_decoration_layouts (HdyHeaderGroup *self)
}
hdy_header_group_child_set_decoration_layout (start_child, start_layout);
hdy_header_group_child_set_decoration_layout (end_child, end_layout);
+
+ g_free (start_layout);
+ g_free (end_layout);
+ g_strfreev (ends);
+ g_free (layout);
}
static void
diff --git a/src/hdy-keypad-button.c b/src/hdy-keypad-button.c
index 436555d8..2b543d91 100644
--- a/src/hdy-keypad-button.c
+++ b/src/hdy-keypad-button.c
@@ -41,7 +41,7 @@ G_DEFINE_TYPE (HdyKeypadButton, hdy_keypad_button, GTK_TYPE_BUTTON)
static void
format_label(HdyKeypadButton *self)
{
- g_autofree gchar *text = NULL;
+ gchar *text = NULL;
gchar *secondary_text = NULL;
if (self->symbols != NULL && *(self->symbols) != '\0') {
@@ -51,6 +51,8 @@ format_label(HdyKeypadButton *self)
gtk_label_set_label (self->label, text);
gtk_label_set_label (self->secondary_label, secondary_text);
+
+ g_free (text);
}
static void
diff --git a/src/hdy-keypad.c b/src/hdy-keypad.c
index f258fcf7..936cc669 100644
--- a/src/hdy-keypad.c
+++ b/src/hdy-keypad.c
@@ -58,17 +58,18 @@ symbol_clicked (HdyKeypad *self,
gchar symbol)
{
HdyKeypadPrivate *priv = hdy_keypad_get_instance_private (self);
- g_autofree gchar *string = g_strdup_printf ("%c", symbol);
-
- if (!priv->entry)
- return;
+ gchar *string = g_strdup_printf ("%c", symbol);
+
+ if (priv->entry) {
+ g_signal_emit_by_name (priv->entry, "insert-at-cursor", string, NULL);
+ /* Set focus to the entry only when it can get focus
+ * https://gitlab.gnome.org/GNOME/gtk/issues/2204
+ */
+ if (gtk_widget_get_can_focus (GTK_WIDGET (priv->entry)))
+ gtk_entry_grab_focus_without_selecting (priv->entry);
+ }
- g_signal_emit_by_name (priv->entry, "insert-at-cursor", string, NULL);
- /* Set focus to the entry only when it can get focus
- * https://gitlab.gnome.org/GNOME/gtk/issues/2204
- */
- if (gtk_widget_get_can_focus (GTK_WIDGET (priv->entry)))
- gtk_entry_grab_focus_without_selecting (priv->entry);
+ g_free (string);
}
diff --git a/src/hdy-main.c b/src/hdy-main.c
index 008cdb2c..9ff0883b 100644
--- a/src/hdy-main.c
+++ b/src/hdy-main.c
@@ -69,8 +69,8 @@ hdy_themes_get_theme_name (gboolean *prefer_dark_theme)
static void
hdy_themes_update (GtkCssProvider *css_provider)
{
- g_autofree gchar *theme_name = NULL;
- g_autofree gchar *resource_path = NULL;
+ gchar *theme_name;
+ gchar *resource_path;
gboolean prefer_dark_theme = FALSE;
g_assert (GTK_IS_CSS_PROVIDER (css_provider));
@@ -96,19 +96,23 @@ hdy_themes_update (GtkCssProvider *css_provider)
}
gtk_css_provider_load_from_resource (css_provider, resource_path);
+
+ g_free (resource_path);
+ g_free (theme_name);
}
static void
load_fallback_style (void)
{
- g_autoptr (GtkCssProvider) css_provider = NULL;
+ GtkCssProvider *css_provider = gtk_css_provider_new ();
- css_provider = gtk_css_provider_new ();
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
gtk_css_provider_load_from_resource (css_provider, HDY_THEMES_PATH"fallback.css");
+
+ g_object_unref (css_provider);
}
/**
@@ -123,7 +127,7 @@ static void
hdy_style_init (void)
{
static gsize guard = 0;
- g_autoptr (GtkCssProvider) css_provider = NULL;
+ GtkCssProvider *css_provider;
GtkSettings *settings;
if (!g_once_init_enter (&guard))
@@ -148,6 +152,8 @@ hdy_style_init (void)
load_fallback_style ();
+ g_object_unref (css_provider);
+
g_once_init_leave (&guard, 1);
}
diff --git a/src/hdy-preferences-group.c b/src/hdy-preferences-group.c
index b4a96285..926e7fe1 100644
--- a/src/hdy-preferences-group.c
+++ b/src/hdy-preferences-group.c
@@ -76,7 +76,7 @@ static void
update_listbox_visibility (HdyPreferencesGroup *self)
{
HdyPreferencesGroupPrivate *priv = hdy_preferences_group_get_instance_private (self);
- g_autoptr(GList) children = NULL;
+ GList *children;
/* We must wait until the listbox has been built and added. */
if (priv->listbox == NULL)
@@ -85,6 +85,8 @@ update_listbox_visibility (HdyPreferencesGroup *self)
children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
gtk_widget_set_visible (GTK_WIDGET (priv->listbox), children != NULL);
+
+ g_list_free (children);
}
static gboolean
diff --git a/src/hdy-preferences-window.c b/src/hdy-preferences-window.c
index 84180140..80ddf814 100644
--- a/src/hdy-preferences-window.c
+++ b/src/hdy-preferences-window.c
@@ -69,7 +69,7 @@ static GParamSpec *props[LAST_PROP];
static gchar *
strip_mnemonic (const gchar *src)
{
- g_autofree gchar *new_str = g_new (gchar, strlen (src) + 1);
+ gchar *new_str = g_new (gchar, strlen (src) + 1);
gchar *dest = new_str;
gboolean underscore = FALSE;
@@ -104,7 +104,7 @@ strip_mnemonic (const gchar *src)
*dest = 0;
- return g_steal_pointer (&new_str);
+ return new_str;
}
static gboolean
@@ -112,9 +112,10 @@ filter_search_results (HdyActionRow *row,
HdyPreferencesWindow *self)
{
HdyPreferencesWindowPrivate *priv = hdy_preferences_window_get_instance_private (self);
- g_autofree gchar *text = g_utf8_casefold (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)), -1);
- g_autofree gchar *title = g_utf8_casefold (hdy_preferences_row_get_title (HDY_PREFERENCES_ROW (row)), -1);
- g_autofree gchar *subtitle = NULL;
+ gchar *text = g_utf8_casefold (gtk_entry_get_text (GTK_ENTRY (priv->search_entry)), -1);
+ gchar *title = g_utf8_casefold (hdy_preferences_row_get_title (HDY_PREFERENCES_ROW (row)), -1);
+ gchar *subtitle = NULL;
+ gboolean result;
/* The CSS engine works in such a way that invisible children are treated as
* visible widgets, which breaks the expectations of the .preferences style
@@ -140,21 +141,29 @@ filter_search_results (HdyActionRow *row,
priv->n_last_search_results++;
gtk_widget_show (GTK_WIDGET (row));
- return TRUE;
+ result = TRUE;
+ } else {
+ subtitle = g_utf8_casefold (hdy_action_row_get_subtitle (row), -1);
}
- subtitle = g_utf8_casefold (hdy_action_row_get_subtitle (row), -1);
+ if (subtitle != NULL) {
+ if (!!strstr (subtitle, text)) {
+ priv->n_last_search_results++;
+ gtk_widget_show (GTK_WIDGET (row));
- if (!!strstr (subtitle, text)) {
- priv->n_last_search_results++;
- gtk_widget_show (GTK_WIDGET (row));
+ result = TRUE;
+ } else {
+ gtk_widget_hide (GTK_WIDGET (row));
- return TRUE;
+ result = FALSE;
+ }
}
- gtk_widget_hide (GTK_WIDGET (row));
+ g_free (subtitle);
+ g_free (title);
+ g_free (text);
- return FALSE;
+ return result;
}
static GtkWidget *
@@ -194,8 +203,10 @@ new_search_row_for_preference (HdyPreferencesRow *row,
if (group_title && !hdy_view_switcher_title_get_title_visible (priv->view_switcher_title))
hdy_action_row_set_subtitle (widget, group_title);
if (group_title) {
- g_autofree gchar *subtitle = g_strdup_printf ("%s → %s", page_title != NULL ? page_title : _("Untitled
page"), group_title);
+ gchar *subtitle = g_strdup_printf ("%s → %s", page_title != NULL ? page_title : _("Untitled page"),
group_title);
hdy_action_row_set_subtitle (widget, subtitle);
+
+ g_free (subtitle);
} else if (page_title)
hdy_action_row_set_subtitle (widget, page_title);
@@ -211,7 +222,7 @@ static void
update_search_results (HdyPreferencesWindow *self)
{
HdyPreferencesWindowPrivate *priv = hdy_preferences_window_get_instance_private (self);
- g_autoptr (GListStore) model;
+ GListStore *model;
model = g_list_store_new (HDY_TYPE_PREFERENCES_ROW);
gtk_container_foreach (GTK_CONTAINER (priv->pages_stack), (GtkCallback)
hdy_preferences_page_add_preferences_to_model, model);
@@ -219,6 +230,8 @@ update_search_results (HdyPreferencesWindow *self)
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (model)); i++)
gtk_container_add (GTK_CONTAINER (priv->search_results),
new_search_row_for_preference ((HdyPreferencesRow *) g_list_model_get_item
(G_LIST_MODEL (model), i), self));
+
+ g_object_unref (model);
}
static void
diff --git a/src/hdy-settings.c b/src/hdy-settings.c
index 3845c4bd..c0523c0d 100644
--- a/src/hdy-settings.c
+++ b/src/hdy-settings.c
@@ -298,8 +298,8 @@ static void
init_gsettings (HdySettings *self)
{
GSettingsSchemaSource *source;
- g_autoptr (GSettingsSchema) schema = NULL;
- g_autoptr (GSettingsSchema) a11y_schema = NULL;
+ GSettingsSchema *schema;
+ GSettingsSchema *a11y_schema;
#ifndef G_OS_WIN32
/* While we can access gsettings in flatpak, we can't do anything useful with
@@ -337,6 +337,9 @@ init_gsettings (HdySettings *self)
G_CALLBACK (gsettings_high_contrast_changed_cb),
self);
}
+
+ g_settings_schema_unref (a11y_schema);
+ g_settings_schema_unref (schema);
}
/* Legacy */
@@ -344,7 +347,8 @@ init_gsettings (HdySettings *self)
static gboolean
is_theme_high_contrast (void)
{
- g_autofree gchar *icon_theme_name = NULL;
+ gchar *icon_theme_name;
+ gboolean result;
/* We're using icon theme here as we control gtk-theme-name and it
* interferes with the notifications. */
@@ -352,8 +356,12 @@ is_theme_high_contrast (void)
"gtk-icon-theme-name", &icon_theme_name,
NULL);
- return !g_strcmp0 (icon_theme_name, "HighContrast") ||
- !g_strcmp0 (icon_theme_name, "HighContrastInverse");
+ result = !g_strcmp0 (icon_theme_name, "HighContrast") ||
+ !g_strcmp0 (icon_theme_name, "HighContrastInverse");
+
+ g_free (icon_theme_name);
+
+ return result;
}
static void
diff --git a/src/hdy-shadow-helper.c b/src/hdy-shadow-helper.c
index 03d83a33..17670bd7 100644
--- a/src/hdy-shadow-helper.c
+++ b/src/hdy-shadow-helper.c
@@ -62,7 +62,7 @@ create_context (HdyShadowHelper *self,
const gchar *name,
GtkPanDirection direction)
{
- g_autoptr(GtkWidgetPath) path = NULL;
+ GtkWidgetPath *path;
GtkStyleContext *context;
gint pos;
const gchar *direction_name;
@@ -81,6 +81,7 @@ create_context (HdyShadowHelper *self,
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
+ gtk_widget_path_unref (path);
g_type_class_unref (enum_class);
return context;
@@ -118,9 +119,9 @@ create_element_pattern (GtkStyleContext *context,
gint height,
gint scale)
{
- g_autoptr (cairo_surface_t) surface =
+ cairo_surface_t *surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale);
- g_autoptr (cairo_t) cr = cairo_create (surface);
+ cairo_t *cr = cairo_create (surface);
cairo_pattern_t *pattern;
cairo_surface_set_device_scale (surface, scale, scale);
@@ -130,6 +131,9 @@ create_element_pattern (GtkStyleContext *context,
pattern = cairo_pattern_create_for_surface (surface);
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
return pattern;
}
@@ -139,10 +143,10 @@ cache_shadow (HdyShadowHelper *self,
gint height,
GtkPanDirection direction)
{
- g_autoptr(GtkStyleContext) dim_context = NULL;
- g_autoptr(GtkStyleContext) shadow_context = NULL;
- g_autoptr(GtkStyleContext) border_context = NULL;
- g_autoptr(GtkStyleContext) outline_context = NULL;
+ GtkStyleContext *dim_context;
+ GtkStyleContext *shadow_context;
+ GtkStyleContext *border_context;
+ GtkStyleContext *outline_context;
gint shadow_size, border_size, outline_size, scale;
scale = gtk_widget_get_scale_factor (self->widget);
@@ -185,6 +189,11 @@ cache_shadow (HdyShadowHelper *self,
self->last_width = width;
self->last_height = height;
self->last_scale = scale;
+
+ g_object_unref (outline_context);
+ g_object_unref (border_context);
+ g_object_unref (shadow_context);
+ g_object_unref (dim_context);
}
static void
diff --git a/src/hdy-squeezer.c b/src/hdy-squeezer.c
index 8e0c6fb6..f5f64131 100644
--- a/src/hdy-squeezer.c
+++ b/src/hdy-squeezer.c
@@ -732,7 +732,7 @@ hdy_squeezer_draw (GtkWidget *widget,
if (gtk_progress_tracker_get_state (&self->tracker) != GTK_PROGRESS_STATE_AFTER) {
if (self->last_visible_surface == NULL &&
self->last_visible_child != NULL) {
- g_autoptr (cairo_t) pattern_cr = NULL;
+ cairo_t *pattern_cr;
gtk_widget_get_allocation (self->last_visible_child->widget,
&self->last_visible_surface_allocation);
@@ -746,6 +746,8 @@ hdy_squeezer_draw (GtkWidget *widget,
* bin_window offset.
*/
gtk_widget_draw (self->last_visible_child->widget, pattern_cr);
+
+ cairo_destroy (pattern_cr);
}
cairo_rectangle (cr,
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index 7ebeb66f..2ec9c324 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -2302,7 +2302,7 @@ void
hdy_stackable_box_remove (HdyStackableBox *self,
GtkWidget *widget)
{
- g_autoptr (HdyStackableBoxChildInfo) child_info = find_child_info_for_widget (self, widget);
+ HdyStackableBoxChildInfo *child_info = find_child_info_for_widget (self, widget);
gboolean contains_child = child_info != NULL;
g_return_if_fail (contains_child);
@@ -2326,6 +2326,8 @@ hdy_stackable_box_remove (HdyStackableBox *self,
unregister_window (self, child_info);
gtk_widget_unparent (widget);
+
+ free_child_info (child_info);
}
void
@@ -2338,7 +2340,7 @@ hdy_stackable_box_forall (HdyStackableBox *self,
* looping through it, for example by calling hdy_stackable_box_remove() on all
* children when destroying the HdyStackableBox_private_offset.
*/
- g_autoptr (GList) children_copy = g_list_copy (self->children);
+ GList *children_copy = g_list_copy (self->children);
GList *children;
HdyStackableBoxChildInfo *child_info;
@@ -2351,6 +2353,8 @@ hdy_stackable_box_forall (HdyStackableBox *self,
g_list_free (self->children_reversed);
self->children_reversed = g_list_copy (self->children);
self->children_reversed = g_list_reverse (self->children_reversed);
+
+ g_list_free (children_copy);
}
static void
diff --git a/src/hdy-style-manager.c b/src/hdy-style-manager.c
index f18d4996..afbbfb23 100644
--- a/src/hdy-style-manager.c
+++ b/src/hdy-style-manager.c
@@ -108,8 +108,8 @@ find_theme_dir (const gchar *dir,
const gchar *name,
const gchar *variant)
{
- g_autofree gchar *file = NULL;
- g_autofree gchar *base = NULL;
+ gchar *file;
+ gchar *base;
gchar *path;
gint i;
@@ -124,7 +124,8 @@ find_theme_dir (const gchar *dir,
base = g_build_filename (dir, name, NULL);
for (i = MINOR; i >= 0; i = i - 2) {
- g_autofree gchar *subsubdir = NULL;
+ gchar *subsubdir;
+ gboolean exists;
if (i < 14)
i = 0;
@@ -132,13 +133,18 @@ find_theme_dir (const gchar *dir,
subsubdir = g_strdup_printf ("gtk-3.%d", i);
path = g_build_filename (base, subsubdir, file, NULL);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
- break;
+ exists = g_file_test (path, G_FILE_TEST_EXISTS);
+
+ g_clear_pointer (&path, g_free);
+ g_free (subsubdir);
- g_free (path);
- path = NULL;
+ if (exists)
+ break;
}
+ g_free (base);
+ g_free (file);
+
return path;
}
@@ -148,7 +154,7 @@ static gchar *
find_theme (const gchar *name,
const gchar *variant)
{
- g_autofree gchar *dir = NULL;
+ gchar *dir;
const gchar *const *dirs;
gchar *path;
gint i;
@@ -175,6 +181,8 @@ find_theme (const gchar *name,
dir = get_theme_dir ();
path = find_theme_dir (dir, NULL, name, variant);
+ g_free (dir);
+
return path;
}
@@ -182,8 +190,9 @@ static gboolean
check_theme_exists (const gchar *name,
const gchar *variant)
{
- g_autofree gchar *resource_path = NULL;
- g_autofree gchar *path = NULL;
+ gchar *resource_path;
+ gchar *path = NULL;
+ gboolean result;
/* try loading the resource for the theme. This is mostly meant for built-in
* themes.
@@ -193,34 +202,50 @@ check_theme_exists (const gchar *name,
else
resource_path = g_strdup_printf ("/org/gtk/libgtk/theme/%s/gtk.css", name);
- if (g_resources_get_info (resource_path, 0, NULL, NULL, NULL))
- return TRUE;
+ if (!g_resources_get_info (resource_path, 0, NULL, NULL, NULL)) {
+ /* Next try looking for files in the various theme directories. */
+ path = find_theme (name, variant);
+
+ result = path != NULL;
+ } else {
+ result = TRUE;
+ }
- /* Next try looking for files in the various theme directories. */
- path = find_theme (name, variant);
+ g_free (resource_path);
+ g_free (path);
- return path != NULL;
+ return result;
}
static gchar *
get_system_theme_name (void)
{
GdkScreen *screen = gdk_screen_get_default ();
- g_auto (GValue) value = G_VALUE_INIT;
+ GValue value = G_VALUE_INIT;
+ gchar *result;
g_value_init (&value, G_TYPE_STRING);
if (!gdk_screen_get_setting (screen, "gtk-theme-name", &value))
- return g_strdup ("Adwaita");
+ result = g_strdup ("Adwaita");
+ else
+ result = g_value_dup_string (&value);
+
+ g_value_unset (&value);
- return g_value_dup_string (&value);
+ return result;
}
static gboolean
check_current_theme_exists (gboolean dark)
{
- g_autofree gchar *theme_name = get_system_theme_name ();
+ gchar *theme_name = get_system_theme_name ();
+ gboolean result;
- return check_theme_exists (theme_name, dark ? "dark" : NULL);
+ result = check_theme_exists (theme_name, dark ? "dark" : NULL);
+
+ g_free (theme_name);
+
+ return result;
}
static void
@@ -648,7 +673,7 @@ static void
hdy_style_manager_ensure (void)
{
GdkDisplayManager *display_manager = gdk_display_manager_get ();
- g_autoptr (GSList) displays = NULL;
+ GSList *displays;
GSList *l;
if (display_style_managers)
@@ -669,6 +694,8 @@ hdy_style_manager_ensure (void)
"display-opened",
G_CALLBACK (register_display),
NULL);
+
+ g_slist_free (displays);
}
/**
diff --git a/src/hdy-swipe-tracker.c b/src/hdy-swipe-tracker.c
index ba01bd05..8357efef 100644
--- a/src/hdy-swipe-tracker.c
+++ b/src/hdy-swipe-tracker.c
@@ -201,13 +201,15 @@ get_range (HdySwipeTracker *self,
gdouble *first,
gdouble *last)
{
- g_autofree gdouble *points = NULL;
+ gdouble *points;
gint n;
points = hdy_swipeable_get_snap_points (self->swipeable, &n);
*first = points[0];
*last = points[n - 1];
+
+ g_free (points);
}
static void
@@ -241,7 +243,7 @@ gesture_prepare (HdySwipeTracker *self,
static void
trim_history (HdySwipeTracker *self)
{
- g_autoptr (GdkEvent) event = gtk_get_current_event ();
+ GdkEvent *event = gtk_get_current_event ();
guint32 threshold_time = gdk_event_get_time (event) - EVENT_HISTORY_THRESHOLD_MS;
guint i;
@@ -255,13 +257,15 @@ trim_history (HdySwipeTracker *self)
if (i > 0)
g_array_remove_range (self->event_history, 0, i);
+
+ gdk_event_free (event);
}
static void
append_to_history (HdySwipeTracker *self,
gdouble delta)
{
- g_autoptr (GdkEvent) event = gtk_get_current_event ();
+ GdkEvent *event = gtk_get_current_event ();
EventHistoryRecord record;
trim_history (self);
@@ -270,6 +274,8 @@ append_to_history (HdySwipeTracker *self,
record.time = gdk_event_get_time (event);
g_array_append_val (self->event_history, record);
+
+ gdk_event_free (event);
}
static gdouble
@@ -400,11 +406,13 @@ gesture_update (HdySwipeTracker *self,
return;
if (!self->allow_long_swipes) {
- g_autofree gdouble *points = NULL;
+ gdouble *points;
gint n;
points = hdy_swipeable_get_snap_points (self->swipeable, &n);
get_bounds (self, points, n, self->initial_progress, &lower, &upper);
+
+ g_free (points);
} else {
get_range (self, &lower, &upper);
}
@@ -423,7 +431,7 @@ get_end_progress (HdySwipeTracker *self,
gboolean is_touchpad)
{
gdouble pos, decel, slope;
- g_autofree gdouble *points = NULL;
+ gdouble *points;
gint n;
gdouble lower, upper;
@@ -432,34 +440,37 @@ get_end_progress (HdySwipeTracker *self,
points = hdy_swipeable_get_snap_points (self->swipeable, &n);
- if (ABS (velocity) < (is_touchpad ? VELOCITY_THRESHOLD_TOUCHPAD : VELOCITY_THRESHOLD_TOUCH))
- return points[find_closest_point (points, n, self->progress)];
+ if (ABS (velocity) < (is_touchpad ? VELOCITY_THRESHOLD_TOUCHPAD : VELOCITY_THRESHOLD_TOUCH)) {
+ pos = points[find_closest_point (points, n, self->progress)];
+ } else {
+ decel = is_touchpad ? DECELERATION_TOUCHPAD : DECELERATION_TOUCH;
+ slope = decel / (1.0 - decel) / 1000.0;
- decel = is_touchpad ? DECELERATION_TOUCHPAD : DECELERATION_TOUCH;
- slope = decel / (1.0 - decel) / 1000.0;
+ if (ABS (velocity) > VELOCITY_CURVE_THRESHOLD) {
+ const gdouble c = slope / 2 / DECELERATION_PARABOLA_MULTIPLIER;
+ const gdouble x = ABS (velocity) - VELOCITY_CURVE_THRESHOLD + c;
- if (ABS (velocity) > VELOCITY_CURVE_THRESHOLD) {
- const gdouble c = slope / 2 / DECELERATION_PARABOLA_MULTIPLIER;
- const gdouble x = ABS (velocity) - VELOCITY_CURVE_THRESHOLD + c;
+ pos = DECELERATION_PARABOLA_MULTIPLIER * x * x
+ - DECELERATION_PARABOLA_MULTIPLIER * c * c
+ + slope * VELOCITY_CURVE_THRESHOLD;
+ } else {
+ pos = ABS (velocity) * slope;
+ }
- pos = DECELERATION_PARABOLA_MULTIPLIER * x * x
- - DECELERATION_PARABOLA_MULTIPLIER * c * c
- + slope * VELOCITY_CURVE_THRESHOLD;
- } else {
- pos = ABS (velocity) * slope;
- }
+ pos = (pos * SIGN (velocity)) + self->progress;
- pos = (pos * SIGN (velocity)) + self->progress;
+ if (!self->allow_long_swipes) {
- if (!self->allow_long_swipes) {
+ get_bounds (self, points, n, self->initial_progress, &lower, &upper);
+ } else {
+ get_range (self, &lower, &upper);
+ }
- get_bounds (self, points, n, self->initial_progress, &lower, &upper);
- } else {
- get_range (self, &lower, &upper);
+ pos = CLAMP (pos, lower, upper);
+ pos = points[find_point_for_projection (self, points, n, pos, velocity)];
}
- pos = CLAMP (pos, lower, upper);
- pos = points[find_point_for_projection (self, points, n, pos, velocity)];
+ g_free (points);
return pos;
}
diff --git a/src/hdy-tab-view.c b/src/hdy-tab-view.c
index c69f8e6b..b44bd9a3 100644
--- a/src/hdy-tab-view.c
+++ b/src/hdy-tab-view.c
@@ -760,7 +760,7 @@ insert_page (HdyTabView *self,
gint position,
gboolean pinned)
{
- g_autoptr (HdyTabPage) page =
+ HdyTabPage *page =
g_object_new (HDY_TYPE_TAB_PAGE,
"child", child,
"parent", parent,
@@ -773,6 +773,8 @@ insert_page (HdyTabView *self,
if (!self->selected_page)
hdy_tab_view_set_selected_page (self, page);
+ g_object_unref (page);
+
return page;
}
@@ -2421,7 +2423,7 @@ HdyTabPage *
hdy_tab_view_get_nth_page (HdyTabView *self,
gint position)
{
- g_autoptr (HdyTabPage) page = NULL;
+ HdyTabPage *page;
g_return_val_if_fail (HDY_IS_TAB_VIEW (self), NULL);
g_return_val_if_fail (position >= 0, NULL);
@@ -2429,6 +2431,8 @@ hdy_tab_view_get_nth_page (HdyTabView *self,
page = g_list_model_get_item (G_LIST_MODEL (self->pages), (guint) position);
+ g_object_unref (page);
+
return page;
}
diff --git a/src/hdy-value-object.c b/src/hdy-value-object.c
index 485d4b3d..c00f6b56 100644
--- a/src/hdy-value-object.c
+++ b/src/hdy-value-object.c
@@ -68,9 +68,10 @@ hdy_value_object_new (const GValue *value)
HdyValueObject*
hdy_value_object_new_collect (GType type, ...)
{
- g_auto(GValue) value = G_VALUE_INIT;
- g_autofree gchar *error = NULL;
+ GValue value = G_VALUE_INIT;
+ gchar *error = NULL;
va_list var_args;
+ HdyValueObject *result;
va_start (var_args, type);
@@ -81,9 +82,14 @@ hdy_value_object_new_collect (GType type, ...)
if (error)
g_critical ("%s: %s", G_STRFUNC, error);
- return g_object_new (HDY_TYPE_VALUE_OBJECT,
- "value", &value,
- NULL);
+ result = g_object_new (HDY_TYPE_VALUE_OBJECT,
+ "value", &value,
+ NULL);
+
+ g_free (error);
+ g_value_unset (&value);
+
+ return result;
}
/**
@@ -99,11 +105,16 @@ hdy_value_object_new_collect (GType type, ...)
HdyValueObject*
hdy_value_object_new_string (const gchar *string)
{
- g_auto(GValue) value = G_VALUE_INIT;
+ GValue value = G_VALUE_INIT;
+ HdyValueObject *result;
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, string);
- return hdy_value_object_new (&value);
+ result = hdy_value_object_new (&value);
+
+ g_value_unset (&value);
+
+ return result;
}
/**
@@ -119,11 +130,16 @@ hdy_value_object_new_string (const gchar *string)
HdyValueObject*
hdy_value_object_new_take_string (gchar *string)
{
- g_auto(GValue) value = G_VALUE_INIT;
+ GValue value = G_VALUE_INIT;
+ HdyValueObject *result;
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value, string);
- return hdy_value_object_new (&value);
+ result = hdy_value_object_new (&value);
+
+ g_value_unset (&value);
+
+ return result;
}
static void
diff --git a/src/hdy-view-switcher.c b/src/hdy-view-switcher.c
index 651c8dde..af9acd37 100644
--- a/src/hdy-view-switcher.c
+++ b/src/hdy-view-switcher.c
@@ -92,8 +92,8 @@ update_button (HdyViewSwitcher *self,
GtkWidget *widget,
HdyViewSwitcherButton *button)
{
- g_autofree gchar *title = NULL;
- g_autofree gchar *icon_name = NULL;
+ gchar *title;
+ gchar *icon_name;
gboolean needs_attention;
gtk_container_child_get (GTK_CONTAINER (self->stack), widget,
@@ -111,6 +111,9 @@ update_button (HdyViewSwitcher *self,
gtk_widget_set_visible (GTK_WIDGET (button),
gtk_widget_get_visible (widget) && (title != NULL || icon_name != NULL));
+
+ g_free (icon_name);
+ g_free (title);
}
static void
@@ -221,7 +224,7 @@ static void
add_button_for_stack_child (HdyViewSwitcher *self,
GtkWidget *stack_child)
{
- g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (self->box));
+ GList *children = gtk_container_get_children (GTK_CONTAINER (self->box));
HdyViewSwitcherButton *button = HDY_VIEW_SWITCHER_BUTTON (hdy_view_switcher_button_new ());
g_object_set_data (G_OBJECT (button), "stack-child", stack_child);
@@ -229,9 +232,12 @@ add_button_for_stack_child (HdyViewSwitcher *self,
update_button (self, stack_child, button);
- if (children != NULL)
+ if (children != NULL) {
gtk_radio_button_join_group (GTK_RADIO_BUTTON (button), GTK_RADIO_BUTTON (children->data));
+ g_list_free (children);
+ }
+
gtk_container_add (GTK_CONTAINER (self->box), GTK_WIDGET (button));
g_signal_connect_swapped (button, "clicked", G_CALLBACK (set_visible_stack_child_for_button), self);
@@ -389,7 +395,7 @@ hdy_view_switcher_get_preferred_width (GtkWidget *widget,
gint *nat)
{
HdyViewSwitcher *self = HDY_VIEW_SWITCHER (widget);
- g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (self->box));
+ GList *children = gtk_container_get_children (GTK_CONTAINER (self->box));
gint max_h_min = 0, max_h_nat = 0, max_v_min = 0, max_v_nat = 0;
gint n_children = 0;
@@ -431,13 +437,15 @@ hdy_view_switcher_get_preferred_width (GtkWidget *widget,
}
hdy_css_measure (widget, GTK_ORIENTATION_HORIZONTAL, min, nat);
+
+ g_list_free (children);
}
static gint
is_narrow (HdyViewSwitcher *self,
gint width)
{
- g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (self->box));
+ GList *children = gtk_container_get_children (GTK_CONTAINER (self->box));
gint max_h_min = 0;
gint n_children = 0;
@@ -459,6 +467,8 @@ is_narrow (HdyViewSwitcher *self,
n_children++;
}
+ g_list_free (children);
+
return (max_h_min * n_children) > width;
}
@@ -468,7 +478,7 @@ hdy_view_switcher_size_allocate (GtkWidget *widget,
{
HdyViewSwitcher *self = HDY_VIEW_SWITCHER (widget);
- g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (self->box));
+ GList *children = gtk_container_get_children (GTK_CONTAINER (self->box));
GtkOrientation orientation;
hdy_css_size_allocate (widget, allocation);
@@ -481,6 +491,8 @@ hdy_view_switcher_size_allocate (GtkWidget *widget,
gtk_orientable_set_orientation (GTK_ORIENTABLE (l->data), orientation);
GTK_WIDGET_CLASS (hdy_view_switcher_parent_class)->size_allocate (widget, allocation);
+
+ g_list_free (children);
}
static void
diff --git a/src/hdy-window-handle-controller.c b/src/hdy-window-handle-controller.c
index d6687451..a9b4093e 100644
--- a/src/hdy-window-handle-controller.c
+++ b/src/hdy-window-handle-controller.c
@@ -324,8 +324,9 @@ titlebar_action (HdyWindowHandleController *self,
guint button)
{
GtkSettings *settings;
- g_autofree gchar *action = NULL;
+ gchar *action;
GtkWindow *window = get_window (self);
+ gboolean result;
if (!window)
return FALSE;
@@ -349,13 +350,9 @@ titlebar_action (HdyWindowHandleController *self,
g_assert_not_reached ();
}
- if (action == NULL)
- return FALSE;
-
- if (g_str_equal (action, "none"))
- return FALSE;
-
- if (g_str_has_prefix (action, "toggle-maximize")) {
+ if (action == NULL || g_str_equal (action, "none")){
+ result = FALSE;
+ } else if (g_str_has_prefix (action, "toggle-maximize")) {
/*
* gtk header bar won't show the maximize button if the following
* properties are not met, apply the same to title bar actions for
@@ -365,30 +362,28 @@ titlebar_action (HdyWindowHandleController *self,
gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
hdy_gtk_window_toggle_maximized (window);
- return TRUE;
- }
-
- if (g_str_equal (action, "lower")) {
+ result = TRUE;
+ } else if (g_str_equal (action, "lower")) {
gdk_window_lower (gtk_widget_get_window (GTK_WIDGET (window)));
- return TRUE;
- }
-
- if (g_str_equal (action, "minimize")) {
+ result = TRUE;
+ } else if (g_str_equal (action, "minimize")) {
gdk_window_iconify (gtk_widget_get_window (GTK_WIDGET (window)));
- return TRUE;
- }
-
- if (g_str_equal (action, "menu")) {
+ result = TRUE;
+ } else if (g_str_equal (action, "menu")) {
do_popup (self, (GdkEventButton*) event);
- return TRUE;
+ result = TRUE;
+ } else {
+ g_warning ("Unsupported titlebar action %s", action);
+
+ result = FALSE;
}
- g_warning ("Unsupported titlebar action %s", action);
+ g_free (action);
- return FALSE;
+ return result;
}
static void
diff --git a/src/hdy-window-mixin.c b/src/hdy-window-mixin.c
index fd0d1e90..4dca8053 100644
--- a/src/hdy-window-mixin.c
+++ b/src/hdy-window-mixin.c
@@ -78,7 +78,7 @@ update_child_context (HdyWindowMixin *self,
GtkStyleContext *context,
const gchar *name)
{
- g_autoptr (GtkWidgetPath) path = gtk_widget_path_new ();
+ GtkWidgetPath *path = gtk_widget_path_new ();
GtkStyleContext *parent = gtk_widget_get_style_context (GTK_WIDGET (self->window));
gint position;
@@ -88,6 +88,8 @@ update_child_context (HdyWindowMixin *self,
gtk_style_context_set_path (context, path);
gtk_style_context_set_state (context, gtk_style_context_get_state (parent));
+
+ gtk_widget_path_unref (path);
}
static void
@@ -215,7 +217,7 @@ create_masks (HdyWindowMixin *self,
return;
for (i = 0; i < HDY_N_CORNERS; i++) {
- g_autoptr (cairo_t) mask_cr = NULL;
+ cairo_t *mask_cr;
self->masks[i] =
cairo_surface_create_similar_image (cairo_get_target (cr),
@@ -233,6 +235,8 @@ create_masks (HdyWindowMixin *self,
r,
0, G_PI * 2);
cairo_fill (mask_cr);
+
+ cairo_destroy (mask_cr);
}
}
@@ -348,8 +352,8 @@ hdy_window_mixin_draw (HdyWindowMixin *self,
GdkRectangle clip = { 0 };
gint width, height, x, y, w, h, r, scale_factor;
GtkWidget *titlebar;
- g_autoptr (cairo_surface_t) surface = NULL;
- g_autoptr (cairo_t) surface_cr = NULL;
+ cairo_surface_t *surface = NULL;
+ cairo_t *surface_cr;
GtkBorder shadow;
/* Use the parent drawing unless we have a reason to use masking */
@@ -456,6 +460,9 @@ hdy_window_mixin_draw (HdyWindowMixin *self,
}
cairo_restore (cr);
+
+ cairo_destroy (surface_cr);
+ cairo_surface_destroy (surface);
}
data.self = self;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]