[gtksourceview/wip/fix-search] SearchContext: clear search if buffer is destroyed
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/fix-search] SearchContext: clear search if buffer is destroyed
- Date: Thu, 5 Mar 2015 13:26:13 +0000 (UTC)
commit f5514ab736275f3063bb4a91ed6312e7f625543a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Mar 5 14:19:52 2015 +0100
SearchContext: clear search if buffer is destroyed
Ideally we should call clear_search() (and thus removing the idle
function) _when_ the buffer is destroyed, that is, in a GWeakNotify
callback (i.e. use g_object_weak_ref() instead of
g_object_add_weak_pointer() when setting the buffer). But there is a bug
in GObject that prevents doing this, see:
TODO report bug
gtksourceview/gtksourcesearchcontext.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 5b92558..2a47945 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -2111,6 +2111,13 @@ idle_scan_regex_search (GtkSourceSearchContext *search)
static gboolean
idle_scan_cb (GtkSourceSearchContext *search)
{
+ if (search->priv->buffer == NULL)
+ {
+ search->priv->idle_scan_id = 0;
+ clear_search (search);
+ return G_SOURCE_REMOVE;
+ }
+
return gtk_source_search_settings_get_regex_enabled (search->priv->settings) ?
idle_scan_regex_search (search) :
idle_scan_normal_search (search);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]