From 2de7f3e7231e895d6ac2414113524d2fb30844ec Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 31 May 2016 10:59:45 +0200 Subject: [PATCH] Revert "TextEditorFactory use rvalue refs for creators" This reverts commit 2be30c27ace93ef2d31609b8f17cf405a4a568a7. The above patch puts limitations on the use of the API, while being a questionable optimization. There is no reason why it should not be possible to use lvalues for setting the various creators. And MSVC2013 even thinks that actual functions are lvalues for std::function objects. Change-Id: Ia4daa7c3367b51bd613e1ff840f0ee617d36f54b Reviewed-by: Tim Jenssen --- src/plugins/texteditor/texteditor.cpp | 24 ++++++++++++------------ src/plugins/texteditor/texteditor.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index d912df9b297..bea97973283 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7709,29 +7709,29 @@ TextEditorFactory::~TextEditorFactory() delete d; } -void TextEditorFactory::setDocumentCreator(DocumentCreator &&creator) +void TextEditorFactory::setDocumentCreator(const DocumentCreator &creator) { - d->m_documentCreator = std::move(creator); + d->m_documentCreator = creator; } -void TextEditorFactory::setEditorWidgetCreator(EditorWidgetCreator &&creator) +void TextEditorFactory::setEditorWidgetCreator(const EditorWidgetCreator &creator) { - d->m_widgetCreator = std::move(creator); + d->m_widgetCreator = creator; } -void TextEditorFactory::setEditorCreator(EditorCreator &&creator) +void TextEditorFactory::setEditorCreator(const EditorCreator &creator) { - d->m_editorCreator = std::move(creator); + d->m_editorCreator = creator; } -void TextEditorFactory::setIndenterCreator(IndenterCreator &&creator) +void TextEditorFactory::setIndenterCreator(const IndenterCreator &creator) { - d->m_indenterCreator = std::move(creator); + d->m_indenterCreator = creator; } -void TextEditorFactory::setSyntaxHighlighterCreator(SyntaxHighLighterCreator &&creator) +void TextEditorFactory::setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator) { - d->m_syntaxHighlighterCreator = std::move(creator); + d->m_syntaxHighlighterCreator = creator; } void TextEditorFactory::setUseGenericHighlighter(bool enabled) @@ -7739,9 +7739,9 @@ void TextEditorFactory::setUseGenericHighlighter(bool enabled) d->m_useGenericHighlighter = enabled; } -void TextEditorFactory::setAutoCompleterCreator(AutoCompleterCreator &&creator) +void TextEditorFactory::setAutoCompleterCreator(const AutoCompleterCreator &creator) { - d->m_autoCompleterCreator = std::move(creator); + d->m_autoCompleterCreator = creator; } void TextEditorFactory::setEditorActionHandlers(Id contextId, uint optionalActions) diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index 4e97b6396d0..ce896250e1c 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -634,13 +634,13 @@ public: typedef std::function IndenterCreator; typedef std::function AutoCompleterCreator; - void setDocumentCreator(DocumentCreator &&creator); - void setEditorWidgetCreator(EditorWidgetCreator &&creator); - void setEditorCreator(EditorCreator &&creator); - void setIndenterCreator(IndenterCreator &&creator); - void setSyntaxHighlighterCreator(SyntaxHighLighterCreator &&creator); + void setDocumentCreator(const DocumentCreator &creator); + void setEditorWidgetCreator(const EditorWidgetCreator &creator); + void setEditorCreator(const EditorCreator &creator); + void setIndenterCreator(const IndenterCreator &creator); + void setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator); void setUseGenericHighlighter(bool enabled); - void setAutoCompleterCreator(AutoCompleterCreator &&creator); + void setAutoCompleterCreator(const AutoCompleterCreator &creator); void setEditorActionHandlers(Core::Id contextId, uint optionalActions); void setEditorActionHandlers(uint optionalActions);