GNOME Bugzilla – Bug 749041
BackForwardItem should use GtkTextMark to track location
Last modified: 2017-04-17 03:40:41 UTC
Right now, the IdeBackForwardItem uses an IdeSourceLocation to track it's position. This is fine on startup and shutdown, but during execution, we need to also insert a GtkTextMark into the buffer when loading to represent that location. This way, if there are changes to the buffer, we can still jump to the logical position we intended.
Instead of IdeSourceLocation, the position is currently tracked by IdeUri. Refer to commit ac1b5583ea for more information.
Created attachment 349878 [details] [review] BackForwardItem: Use GtkTextMark to track locations A start in effort series for making "jumps" more accurate. Later, GtkTextMark will make us jump back/forth to logical positions.
Review of attachment 349878 [details] [review]: Couple things to look at ::: libide/history/ide-back-forward-item.c @@ -79,0 +83,7 @@ +ide_back_forward_item_set_mark (IdeBackForwardItem *self, + GtkTextMark *mark) +{ ... 4 more ... This should probably use a weak pointer to avoid a use-after-free. #include "ide-macros.h" if (ide_set_weak_pointer (&self->mark, mark)) g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MARK]); And in dispose or finalize: ide_clear_weak_pointer (&self->mark); @@ +190,3 @@ + "The GtkTextMark for the location", + GTK_TYPE_TEXT_MARK, + (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS and G_PARAM_EXPLICIT_NOTIFY also here. Are you sure you want G_PARAM_CONSTRUCT_ONLY? That only allows setting during creation of the instance.
Created attachment 349882 [details] [review] BackForwardItem: Use GtkTextMark to track locations Next round of the patch taking reviews into account.
Thanks! Pushed with a patch to fix gobject introspection for getters.