[gedit/wip/spell-checking] auto-spell: remove free() function, use g_object_unref() instead
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/spell-checking] auto-spell: remove free() function, use g_object_unref() instead
- Date: Sat, 18 Jul 2015 13:20:56 +0000 (UTC)
commit b4a224ec2ef17502a381fdc69c7d424f0f20570e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jul 18 15:14:59 2015 +0200
auto-spell: remove free() function, use g_object_unref() instead
plugins/spell/gedit-automatic-spell-checker.c | 18 +++++-------------
plugins/spell/gedit-automatic-spell-checker.h | 2 --
plugins/spell/gedit-spell-plugin.c | 5 ++---
3 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index 1277ae4..9fdb01d 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -691,10 +691,9 @@ set_buffer (GeditAutomaticSpellChecker *spell,
spell->buffer = GTK_TEXT_BUFFER (buffer);
- g_object_set_data_full (G_OBJECT (buffer),
- AUTOMATIC_SPELL_CHECKER_KEY,
- spell,
- g_object_unref);
+ g_object_set_data (G_OBJECT (buffer),
+ AUTOMATIC_SPELL_CHECKER_KEY,
+ spell);
g_signal_connect_object (buffer,
"insert-text",
@@ -911,6 +910,8 @@ gedit_automatic_spell_checker_dispose (GObject *object)
gtk_text_tag_table_remove (table, spell->tag_highlight);
}
+ g_object_set_data (G_OBJECT (spell->buffer), AUTOMATIC_SPELL_CHECKER_KEY, NULL);
+
spell->buffer = NULL;
}
@@ -986,15 +987,6 @@ gedit_automatic_spell_checker_get_from_buffer (GtkSourceBuffer *buffer)
}
void
-gedit_automatic_spell_checker_free (GeditAutomaticSpellChecker *spell)
-{
- g_return_if_fail (GEDIT_IS_AUTOMATIC_SPELL_CHECKER (spell));
- g_return_if_fail (gedit_automatic_spell_checker_get_from_buffer (GTK_SOURCE_BUFFER (spell->buffer))
== spell);
-
- g_object_set_data (G_OBJECT (spell->buffer), AUTOMATIC_SPELL_CHECKER_KEY, NULL);
-}
-
-void
gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
GtkTextView *view)
{
diff --git a/plugins/spell/gedit-automatic-spell-checker.h b/plugins/spell/gedit-automatic-spell-checker.h
index a5b0f33..28e9821 100644
--- a/plugins/spell/gedit-automatic-spell-checker.h
+++ b/plugins/spell/gedit-automatic-spell-checker.h
@@ -44,8 +44,6 @@ GeditAutomaticSpellChecker *
GeditAutomaticSpellChecker *
gedit_automatic_spell_checker_get_from_buffer (GtkSourceBuffer *buffer);
-void gedit_automatic_spell_checker_free (GeditAutomaticSpellChecker *spell);
-
void gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
GtkTextView *view);
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index e663aa7..b9e8e08 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -881,10 +881,9 @@ set_auto_spell (GeditWindow *window,
gedit_automatic_spell_checker_recheck_all (autospell);
}
}
- else
+ else if (autospell != NULL)
{
- if (autospell != NULL)
- gedit_automatic_spell_checker_free (autospell);
+ g_object_unref (autospell);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]