[LyX/master] Remove default parameter of UndoGroupHelper constructor

Jean-Marc Lasgouttes lasgouttes at lyx.org
Wed Sep 23 15:11:47 UTC 2020


commit 967f4d661ec7f53ebb7cdb03e96dc70471781602
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Wed Sep 23 17:28:36 2020 +0200

    Remove default parameter of UndoGroupHelper constructor
    
    This can lead to mistakes. If no buffer is required at the beginning,
    it is better to pass 'nullptr' explicitly.
    
    Fix a case of missing parameter in GuiCompleter (introduced at
    f3656600). This avoids some spurious "There is no group open (creating
    one)" messages.
---
 src/Undo.h                        |    2 +-
 src/frontends/qt/GuiCompleter.cpp |    2 +-
 src/insets/InsetLabel.cpp         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Undo.h b/src/Undo.h
index c2b9b5d..8b482d2 100644
--- a/src/Undo.h
+++ b/src/Undo.h
@@ -139,7 +139,7 @@ private:
  */
 class UndoGroupHelper {
 public:
-	UndoGroupHelper(Buffer * buf = 0);
+	UndoGroupHelper(Buffer * buf);
 
 	~UndoGroupHelper();
 
diff --git a/src/frontends/qt/GuiCompleter.cpp b/src/frontends/qt/GuiCompleter.cpp
index 064049c..c4bb561 100644
--- a/src/frontends/qt/GuiCompleter.cpp
+++ b/src/frontends/qt/GuiCompleter.cpp
@@ -687,7 +687,7 @@ void GuiCompleter::tab()
 	}
 
 	// Make undo possible
-	UndoGroupHelper ugh;
+	UndoGroupHelper ugh(cur.buffer());
 	cur.recordUndo();
 
 	// If completion is active, at least complete by one character
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 5ba0344..ffa2674 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -121,7 +121,7 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
 void InsetLabel::updateReferences(docstring const & old_label,
 		docstring const & new_label)
 {
-	UndoGroupHelper ugh;
+	UndoGroupHelper ugh(nullptr);
 	if (buffer().masterParams().track_changes) {
 		// With change tracking, we insert a new ref and
 		// delete the old one


More information about the lyx-cvs mailing list