After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771373 - Fix gtk_source_buffer_sort_lines()
Fix gtk_source_buffer_sort_lines()
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-13 16:40 UTC by Garrett Regier
Modified: 2016-09-30 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix gtk_source_buffer_sort_lines() (2.85 KB, patch)
2016-09-13 16:40 UTC, Garrett Regier
accepted-commit_after_freeze Details | Review

Description Garrett Regier 2016-09-13 16:40:08 UTC
It does not behave correctly when called where the start iter and end iter are on the same line. Also when the start iter is not at the beginning of a line!
Comment 1 Garrett Regier 2016-09-13 16:40:54 UTC
Created attachment 335450 [details] [review]
Fix gtk_source_buffer_sort_lines()

The start iterator needs to be moved to the start of the line for gtk_text_iter_delete().
Also, return early if the start and end iter are on the same line.
Comment 2 Sébastien Wilmet 2016-09-14 18:03:46 UTC
Review of attachment 335450 [details] [review]:

Looks good, apart for the comment below.

Remember that we are currently in hard code freeze. It's better to wait 3.22.1 to apply the patch.

::: gtksourceview/gtksourcebuffer.c
@@ +2958,3 @@
 	}
 
+	if (start_line == end_line)

It's better to call gtk_text_iter_equal(). I don't think the GtkTextView API guarantees that the two struct instances will be the same (it's an opaque data type).
Comment 3 Sébastien Wilmet 2016-09-14 18:05:38 UTC
Review of attachment 335450 [details] [review]:

Ah, no, sorry for the mistake, I thought the comparison was between two GtkTextIters, but it's the lines.
Comment 4 Garrett Regier 2016-09-27 06:40:38 UTC
Is this now safe to push?
Comment 5 Sébastien Wilmet 2016-09-27 09:31:36 UTC
Yes. You can also backport on gnome-3-22.
Comment 6 Sébastien Wilmet 2016-09-30 12:30:56 UTC
Pushed as commit c9c72a5cfa8609caa38456bc28c7717252f18599 and backported on gnome-3-22.