[gtksourceview: 3/3] Bracket matching: fix FIXME about iter sometimes uninitialized
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 3/3] Bracket matching: fix FIXME about iter sometimes uninitialized
- Date: Sat, 24 Oct 2015 09:26:07 +0000 (UTC)
commit 3a94ddf187e35acb82f239f218f6fbb8018b9dd8
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Oct 24 11:02:28 2015 +0200
Bracket matching: fix FIXME about iter sometimes uninitialized
priv->bracket_match is not equal to FOUND, so the parameter is
meaningless, so it's more logical to provide NULL.
gtksourceview/gtksourcebuffer.c | 2 +-
tests/test-widget.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index f0a881f..e9133f4 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -943,7 +943,7 @@ gtk_source_buffer_move_cursor (GtkTextBuffer *buffer,
g_signal_emit (source_buffer,
buffer_signals[BRACKET_MATCHED],
0,
- &end, /* FIXME end may be uninitialized here... */
+ NULL,
source_buffer->priv->bracket_match);
}
}
diff --git a/tests/test-widget.c b/tests/test-widget.c
index 5c40d99..23a5626 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -820,22 +820,22 @@ bracket_matched_cb (GtkSourceBuffer *buffer,
GEnumClass *eclass;
GEnumValue *evalue;
- g_return_if_fail (iter != NULL);
-
eclass = G_ENUM_CLASS (g_type_class_ref (GTK_SOURCE_TYPE_BRACKET_MATCH_TYPE));
evalue = g_enum_get_value (eclass, state);
g_print ("Bracket match state: '%s'\n", evalue->value_nick);
+ g_type_class_unref (eclass);
+
if (state == GTK_SOURCE_BRACKET_MATCH_FOUND)
{
+ g_return_if_fail (iter != NULL);
+
g_print ("Matched bracket: '%c' at row: %"G_GINT32_FORMAT", col: %"G_GINT32_FORMAT"\n",
gtk_text_iter_get_char (iter),
gtk_text_iter_get_line (iter) + 1,
gtk_text_iter_get_line_offset (iter) + 1);
}
-
- g_type_class_unref (eclass);
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]