Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: third_party/undoview/undo_manager.c

Issue 4683002: Update internal state on undo to avoid a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address James' comments. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/undoview/undo_manager.c
diff --git a/third_party/undoview/undo_manager.c b/third_party/undoview/undo_manager.c
index 9136b37bc263f9aa9f1adb97390d0689ed8ae7fe..6efba9c848af8b9d785ea8f447da9803e3b69ea4 100644
--- a/third_party/undoview/undo_manager.c
+++ b/third_party/undoview/undo_manager.c
@@ -118,6 +118,29 @@ enum {
LAST_SIGNAL
};
+#if !defined(NDEBUG)
+static void
+print_state(GtkSourceUndoManager* um)
+{
+ fprintf(stderr, "\n***\n");
+ GList* actions = um->priv->actions;
+
+ for (; actions; actions = g_list_next(actions)) {
+ GtkSourceUndoAction* act = actions->data;
+ fprintf(stderr, "* type = %s\n", act->action_type == GTK_SOURCE_UNDO_ACTION_DELETE ?
+ "delete" : "insert");
+
+ fprintf(stderr, "\ttext = %s\n", act->action_type == GTK_SOURCE_UNDO_ACTION_DELETE
+ ? act->action.delete.text : act->action.insert.text);
+ fprintf(stderr, "\torder = %d\n", act->order_in_group);
+ }
+
+ fprintf(stderr, "* next redo: %d\n", um->priv->next_redo);
+ fprintf(stderr, "* num of groups: %d\n", um->priv->num_of_groups);
+ fprintf(stderr, "* actions in group: %d\n", um->priv->actions_in_current_group);
+}
+#endif
+
static void gtk_source_undo_manager_class_init(GtkSourceUndoManagerClass *klass);
static void gtk_source_undo_manager_init(GtkSourceUndoManager *um);
static void gtk_source_undo_manager_finalize(GObject *object);
@@ -624,6 +647,7 @@ gtk_source_undo_manager_free_action_list(GtkSourceUndoManager *um) {
if(action->order_in_group == 1)
--um->priv->num_of_groups;
+ um->priv->actions_in_current_group = action->order_in_group - 1;
if(action->modified)
um->priv->modified_action = INVALID;
@@ -787,6 +811,7 @@ gtk_source_undo_manager_free_first_n_actions(GtkSourceUndoManager *um,
if(action->order_in_group == 1)
--um->priv->num_of_groups;
+ um->priv->actions_in_current_group = action->order_in_group - 1;
if(action->modified)
um->priv->modified_action = INVALID;
@@ -827,6 +852,7 @@ gtk_source_undo_manager_check_list_size(GtkSourceUndoManager *um) {
if(undo_action->order_in_group == 1)
--um->priv->num_of_groups;
+ um->priv->actions_in_current_group = undo_action->order_in_group - 1;
if(undo_action->modified)
um->priv->modified_action = INVALID;
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698