[gtksourceview/gnome-3-10] Remove second parameter of gtk_text_region_destroy()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gnome-3-10] Remove second parameter of gtk_text_region_destroy()
- Date: Thu, 10 Oct 2013 22:03:11 +0000 (UTC)
commit 55263e352bde501fb40bb0cd00e114114584b6d9
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Oct 5 22:56:53 2013 +0200
Remove second parameter of gtk_text_region_destroy()
It was a boolean to know if the marks owned by the GtkTextRegion must be
removed from the buffer. In every case we want to remove the marks,
except when the buffer is already finalized, in which case FALSE is
passed as the second parameter.
But now GtkTextRegion has a weak ref to the buffer, so the destroy
function knows when the buffer is finalized.
.../words/gtksourcecompletionwordsbuffer.c | 6 +-
gtksourceview/gtksourcecontextengine.c | 4 +-
gtksourceview/gtksourcesearchcontext.c | 50 ++++++++++----------
gtksourceview/gtktextregion.c | 4 +-
gtksourceview/gtktextregion.h | 3 +-
tests/test-region.c | 4 +-
6 files changed, 35 insertions(+), 36 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
index 13ea6ff..c2d68b7 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
@@ -110,7 +110,7 @@ gtk_source_completion_words_buffer_dispose (GObject *object)
if (buffer->priv->scan_region != NULL)
{
- gtk_text_region_destroy (buffer->priv->scan_region, TRUE);
+ gtk_text_region_destroy (buffer->priv->scan_region);
buffer->priv->scan_region = NULL;
}
@@ -506,7 +506,7 @@ invalidate_region (GtkSourceCompletionWordsBuffer *buffer,
remove_region = compute_remove_region (buffer, start_iter, end_iter);
remove_words_in_region (buffer, remove_region);
- gtk_text_region_destroy (remove_region, TRUE);
+ gtk_text_region_destroy (remove_region);
}
static void
@@ -581,7 +581,7 @@ on_delete_range_before_cb (GtkTextBuffer *text_buffer,
{
remove_all_words (buffer);
- gtk_text_region_destroy (buffer->priv->scan_region, TRUE);
+ gtk_text_region_destroy (buffer->priv->scan_region);
buffer->priv->scan_region = gtk_text_region_new (text_buffer);
}
else
diff --git a/gtksourceview/gtksourcecontextengine.c b/gtksourceview/gtksourcecontextengine.c
index 8e0472e..5ad39ea 100644
--- a/gtksourceview/gtksourcecontextengine.c
+++ b/gtksourceview/gtksourcecontextengine.c
@@ -935,7 +935,7 @@ ensure_highlighted (GtkSourceContextEngine *ce,
gtk_text_region_iterator_next (®_iter);
}
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
/* Remove the just highlighted region. */
gtk_text_region_subtract (ce->priv->refresh_region, start, end);
@@ -2535,7 +2535,7 @@ gtk_source_context_engine_attach_buffer (GtkSourceEngine *engine,
destroy_context_classes_hash (ce);
if (ce->priv->refresh_region != NULL)
- gtk_text_region_destroy (ce->priv->refresh_region, FALSE);
+ gtk_text_region_destroy (ce->priv->refresh_region);
ce->priv->refresh_region = NULL;
}
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index 2a13515..89af1da 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -507,7 +507,7 @@ clear_task (GtkSourceSearchContext *search)
{
if (search->priv->task_region != NULL)
{
- gtk_text_region_destroy (search->priv->task_region, TRUE);
+ gtk_text_region_destroy (search->priv->task_region);
search->priv->task_region = NULL;
}
@@ -530,13 +530,13 @@ clear_search (GtkSourceSearchContext *search)
{
if (search->priv->scan_region != NULL)
{
- gtk_text_region_destroy (search->priv->scan_region, TRUE);
+ gtk_text_region_destroy (search->priv->scan_region);
search->priv->scan_region = NULL;
}
if (search->priv->high_priority_region != NULL)
{
- gtk_text_region_destroy (search->priv->high_priority_region, TRUE);
+ gtk_text_region_destroy (search->priv->high_priority_region);
search->priv->high_priority_region = NULL;
}
@@ -1001,7 +1001,7 @@ smart_forward_search_async_step (GtkSourceSearchContext *search,
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
while (basic_forward_search (search, &iter, &match_start, &match_end, &limit))
@@ -1045,7 +1045,7 @@ smart_forward_search_async_step (GtkSourceSearchContext *search,
if (search->priv->task_region != NULL)
{
- gtk_text_region_destroy (search->priv->task_region, TRUE);
+ gtk_text_region_destroy (search->priv->task_region);
}
search->priv->task_region = region;
@@ -1137,7 +1137,7 @@ smart_backward_search_async_step (GtkSourceSearchContext *search,
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
while (basic_backward_search (search, &iter, &match_start, &match_end, &limit))
@@ -1181,7 +1181,7 @@ smart_backward_search_async_step (GtkSourceSearchContext *search,
if (search->priv->task_region != NULL)
{
- gtk_text_region_destroy (search->priv->task_region, TRUE);
+ gtk_text_region_destroy (search->priv->task_region);
}
search->priv->task_region = region;
@@ -1285,7 +1285,7 @@ adjust_subregion (GtkSourceSearchContext *search,
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
}
}
@@ -1338,7 +1338,7 @@ adjust_subregion (GtkSourceSearchContext *search,
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
}
}
@@ -1460,7 +1460,7 @@ remove_occurrences_in_range (GtkSourceSearchContext *search,
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
}
@@ -1657,7 +1657,7 @@ resume_task (GtkSourceSearchContext *search)
if (search->priv->task_region != NULL)
{
- gtk_text_region_destroy (search->priv->task_region, TRUE);
+ gtk_text_region_destroy (search->priv->task_region);
search->priv->task_region = NULL;
}
@@ -1707,7 +1707,7 @@ idle_scan_normal_search (GtkSourceSearchContext *search)
*/
scan_all_region (search, search->priv->high_priority_region);
- gtk_text_region_destroy (search->priv->high_priority_region, TRUE);
+ gtk_text_region_destroy (search->priv->high_priority_region);
search->priv->high_priority_region = NULL;
return G_SOURCE_CONTINUE;
@@ -1729,7 +1729,7 @@ idle_scan_normal_search (GtkSourceSearchContext *search)
if (search->priv->scan_region != NULL)
{
- gtk_text_region_destroy (search->priv->scan_region, TRUE);
+ gtk_text_region_destroy (search->priv->scan_region);
search->priv->scan_region = NULL;
}
@@ -1794,7 +1794,7 @@ regex_search_handle_high_priority_region (GtkSourceSearchContext *search)
gtk_text_region_iterator_next (®ion_iter);
}
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
/* Returns TRUE if the segment is finished, and FALSE on partial match. */
@@ -2012,7 +2012,7 @@ idle_scan_regex_search (GtkSourceSearchContext *search)
{
regex_search_handle_high_priority_region (search);
- gtk_text_region_destroy (search->priv->high_priority_region, TRUE);
+ gtk_text_region_destroy (search->priv->high_priority_region);
search->priv->high_priority_region = NULL;
return G_SOURCE_CONTINUE;
@@ -2042,7 +2042,7 @@ idle_scan_regex_search (GtkSourceSearchContext *search)
if (search->priv->scan_region != NULL)
{
- gtk_text_region_destroy (search->priv->scan_region, TRUE);
+ gtk_text_region_destroy (search->priv->scan_region);
search->priv->scan_region = NULL;
}
@@ -2103,7 +2103,7 @@ smart_forward_search_step (GtkSourceSearchContext *search,
{
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
while (basic_forward_search (search, &iter, match_start, match_end, &limit))
@@ -2132,7 +2132,7 @@ smart_forward_search_step (GtkSourceSearchContext *search,
scan_region_forward (search, region);
}
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
return FALSE;
}
@@ -2202,7 +2202,7 @@ smart_backward_search_step (GtkSourceSearchContext *search,
{
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
while (basic_backward_search (search, &iter, match_start, match_end, &limit))
@@ -2231,7 +2231,7 @@ smart_backward_search_step (GtkSourceSearchContext *search,
scan_region_forward (search, region);
}
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
return FALSE;
}
@@ -3057,7 +3057,7 @@ gtk_source_search_context_get_occurrence_position (GtkSourceSearchContext *searc
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
if (!empty)
@@ -3097,7 +3097,7 @@ gtk_source_search_context_get_occurrence_position (GtkSourceSearchContext *searc
if (region != NULL)
{
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
}
if (!empty)
@@ -3645,7 +3645,7 @@ _gtk_source_search_context_update_highlight (GtkSourceSearchContext *search,
{
if (region_to_highlight != NULL)
{
- gtk_text_region_destroy (region_to_highlight, TRUE);
+ gtk_text_region_destroy (region_to_highlight);
}
return;
@@ -3660,7 +3660,7 @@ _gtk_source_search_context_update_highlight (GtkSourceSearchContext *search,
* means that the visible region has changed. So we can
* destroy the old high_priority_region.
*/
- gtk_text_region_destroy (search->priv->high_priority_region, TRUE);
+ gtk_text_region_destroy (search->priv->high_priority_region);
}
search->priv->high_priority_region = region_to_highlight;
@@ -3682,6 +3682,6 @@ _gtk_source_search_context_update_highlight (GtkSourceSearchContext *search,
else
{
scan_all_region (search, region_to_highlight);
- gtk_text_region_destroy (region_to_highlight, TRUE);
+ gtk_text_region_destroy (region_to_highlight);
}
}
diff --git a/gtksourceview/gtktextregion.c b/gtksourceview/gtktextregion.c
index 3b1d437..224b3ee 100644
--- a/gtksourceview/gtktextregion.c
+++ b/gtksourceview/gtktextregion.c
@@ -136,13 +136,13 @@ gtk_text_region_new (GtkTextBuffer *buffer)
}
void
-gtk_text_region_destroy (GtkTextRegion *region, gboolean delete_marks)
+gtk_text_region_destroy (GtkTextRegion *region)
{
g_return_if_fail (region != NULL);
while (region->subregions) {
Subregion *sr = region->subregions->data;
- if (delete_marks && region->buffer != NULL) {
+ if (region->buffer != NULL) {
gtk_text_buffer_delete_mark (region->buffer, sr->start);
gtk_text_buffer_delete_mark (region->buffer, sr->end);
}
diff --git a/gtksourceview/gtktextregion.h b/gtksourceview/gtktextregion.h
index 43fc15e..c422633 100644
--- a/gtksourceview/gtktextregion.h
+++ b/gtksourceview/gtktextregion.h
@@ -44,8 +44,7 @@ G_GNUC_INTERNAL
GtkTextRegion *gtk_text_region_new (GtkTextBuffer *buffer);
G_GNUC_INTERNAL
-void gtk_text_region_destroy (GtkTextRegion *region,
- gboolean delete_marks);
+void gtk_text_region_destroy (GtkTextRegion *region);
G_GNUC_INTERNAL
GtkTextBuffer *gtk_text_region_get_buffer (GtkTextRegion *region);
diff --git a/tests/test-region.c b/tests/test-region.c
index f3622a7..61068a4 100644
--- a/tests/test-region.c
+++ b/tests/test-region.c
@@ -105,7 +105,7 @@ test_region (void)
intersection = gtk_text_region_intersect (region, &iter1, &iter2);
if (intersection) {
gtk_text_region_debug_print (intersection);
- gtk_text_region_destroy (intersection, TRUE);
+ gtk_text_region_destroy (intersection);
} else {
g_print ("no intersection\n");
}
@@ -141,7 +141,7 @@ test_region (void)
g_print ("iterated %d subregions\n", i);
- gtk_text_region_destroy (region, TRUE);
+ gtk_text_region_destroy (region);
g_object_unref (buffer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]