diff --git a/PowerEditor/src/MISC/Common/LongRunningOperation.cpp b/PowerEditor/src/MISC/Common/LongRunningOperation.cpp deleted file mode 100644 index afdc73c0e5a..00000000000 --- a/PowerEditor/src/MISC/Common/LongRunningOperation.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// This file is part of Notepad++ project -// Copyright (C)2003 Don HO -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either -// version 2 of the License, or (at your option) any later version. -// -// Note that the GPL places important restrictions on "derived works", yet -// it does not provide a detailed definition of that term. To avoid -// misunderstandings, we consider an application to constitute a -// "derivative work" for the purpose of this license if it does any of the -// following: -// 1. Integrates source code from Notepad++. -// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable -// installer, such as those produced by InstallShield. -// 3. Links to a library or executes a program that does any of the above. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -#include "LongRunningOperation.h" -#include "mutex.h" - -using namespace Yuni; - - - - -LongRunningOperation::LongRunningOperation() -{ - Mutex::ClassLevelLockable::mutex.lock(); -} - - -LongRunningOperation::~LongRunningOperation() -{ - Mutex::ClassLevelLockable::mutex.unlock(); -} - - - diff --git a/PowerEditor/src/MISC/Common/LongRunningOperation.h b/PowerEditor/src/MISC/Common/LongRunningOperation.h deleted file mode 100644 index b1d8e76314e..00000000000 --- a/PowerEditor/src/MISC/Common/LongRunningOperation.h +++ /dev/null @@ -1,39 +0,0 @@ -// This file is part of Notepad++ project -// Copyright (C)2003 Don HO -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either -// version 2 of the License, or (at your option) any later version. -// -// Note that the GPL places important restrictions on "derived works", yet -// it does not provide a detailed definition of that term. To avoid -// misunderstandings, we consider an application to constitute a -// "derivative work" for the purpose of this license if it does any of the -// following: -// 1. Integrates source code from Notepad++. -// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable -// installer, such as those produced by InstallShield. -// 3. Links to a library or executes a program that does any of the above. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -#ifndef M30_IDE_LONGRUNNINGOPERATION_h -#define M30_IDE_LONGRUNNINGOPERATION_h - -class LongRunningOperation -{ -public: - LongRunningOperation(); - ~LongRunningOperation(); -}; - -#endif //M30_IDE_LONGRUNNINGOPERATION_h diff --git a/PowerEditor/src/MISC/Common/mutex.cpp b/PowerEditor/src/MISC/Common/mutex.cpp deleted file mode 100644 index 69e723663a6..00000000000 --- a/PowerEditor/src/MISC/Common/mutex.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// YUNI's default license is the GNU Lesser Public License (LGPL), with some -// exclusions (see below). This basically means that you can get the full source -// code for nothing, so long as you adhere to a few rules. -// -// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you -// require, as long as you: -// -// Pass on the (modified) YUNI source code with your software, with original -// copyrights intact : -// * If you distribute electronically, the source can be a separate download -// (either from your own site if you modified YUNI, or to the official YUNI -// website if you used an unmodified version) – just include a link in your -// documentation -// * If you distribute physical media, the YUNI source that you used to build -// your application should be included on that media -// Make it clear where you have customised it. -// -// In addition to the LGPL license text, the following exceptions / clarifications -// to the LGPL conditions apply to YUNI: -// -// * Making modifications to YUNI configuration files, build scripts and -// configuration headers such as yuni/platform.h in order to create a -// customised build setup of YUNI with the otherwise unmodified source code, -// does not constitute a derived work -// * Building against YUNI headers which have inlined code does not constitute a -// derived work -// * Code which subclasses YUNI classes outside of the YUNI libraries does not -// form a derived work -// * Statically linking the YUNI libraries into a user application does not make -// the user application a derived work. -// * Using source code obsfucation on the YUNI source code when distributing it -// is not permitted. -// As per the terms of the LGPL, a "derived work" is one for which you have to -// distribute source code for, so when the clauses above define something as not -// a derived work, it means you don't have to distribute source code for it. -// However, the original YUNI source code with all modifications must always be -// made available. - -#include "mutex.h" -#include -#include -#include - -#if YUNI_ATOMIC_MUST_USE_MUTEX != 0 -#warning Atomic types must ue mutex. the implementation should be checked YUNI_OS_GCC_VERSION -#endif - - - -namespace Yuni -{ - - enum // anonymous - { - /*! - ** \brief The spin count for the critical section object - ** - ** On single-processor systems, the spin count is ignored and the critical section - ** spin count is set to 0 (zero). On multiprocessor systems, if the critical section - ** is unavailable, the calling thread spinsdwSpinCount times before performing a - ** wait operation on a semaphore associated with the critical section. If the critical - ** section becomes free during the spin operation, the calling thread avoids the - ** wait operation. - ** \see http://msdn.microsoft.com/en-us/library/ms683476%28v=vs.85%29.aspx - */ - spinCount = 3000, - }; - - - - inline void Mutex::destroy() - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - DeleteCriticalSection(&pSection); - # else - switch (::pthread_mutex_destroy(&pLock)) - { - case 0: // Ok good - { - break; - } - // If an error happens, we will let the program continue but - // it can becaome ugly around here... - case EBUSY: - { - std::cerr << "\nattempt to destroy a mutex while it is locked or referenced\n"; - assert(false and "attempt to destroy a mutex while it is locked or referenced"); - break; - } - default: - { - std::cerr << "\nfailed to destroy a mutex\n"; - assert(false and "\nfailed to destroy a mutex\n"); - break; - } - } - ::pthread_mutexattr_destroy(&pAttr); - # endif - # endif // no thread safe - } - - - inline void Mutex::copy(const Mutex& rhs) - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - InitializeCriticalSectionAndSpinCount(&pSection, spinCount); - (void) rhs; // unused - # else - ::pthread_mutexattr_init(&pAttr); - int type; // = PTHREAD_MUTEX_NORMAL; - if (0 == ::pthread_mutexattr_gettype(&rhs.pAttr, &type)) - { - if (PTHREAD_MUTEX_RECURSIVE == type) - { - # if defined(YUNI_OS_DARWIN) or defined(YUNI_OS_FREEBSD) or defined(YUNI_OS_SOLARIS) or defined(YUNI_OS_SUNOS) or defined(YUNI_OS_HAIKU) or defined(YUNI_OS_CYGWIN) - ::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE); - # else - ::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE_NP); - # endif - } - } - ::pthread_mutex_init(& pLock, &pAttr); - # endif - # else - (void) rhs; // unused - # endif // no thread safe - } - - - - Mutex::Mutex(const Mutex& rhs) - { - copy(rhs); - } - - - Mutex::~Mutex() - { - destroy(); - } - - - Mutex::Mutex(bool recursive) - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - (void) recursive; // already recursive on Windows - InitializeCriticalSectionAndSpinCount(&pSection, spinCount); - # else - ::pthread_mutexattr_init(&pAttr); - if (recursive) - { - # if defined(YUNI_OS_DARWIN) or defined(YUNI_OS_FREEBSD) or defined(YUNI_OS_SOLARIS) or defined(YUNI_OS_SUNOS) or defined(YUNI_OS_HAIKU) or defined(YUNI_OS_CYGWIN) - ::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE); - # else - ::pthread_mutexattr_settype(&pAttr, PTHREAD_MUTEX_RECURSIVE_NP); - # endif - } - ::pthread_mutex_init(&pLock, &pAttr); - # endif - # else - (void) recursive; - # endif - } - - - Mutex& Mutex::operator = (const Mutex& rhs) - { - // We will recreate the mutex - destroy(); - copy(rhs); - return *this; - } - - - - - -} // namespace Yuni diff --git a/PowerEditor/src/MISC/Common/mutex.h b/PowerEditor/src/MISC/Common/mutex.h deleted file mode 100644 index 44a5c15c2f2..00000000000 --- a/PowerEditor/src/MISC/Common/mutex.h +++ /dev/null @@ -1,234 +0,0 @@ -// YUNI's default license is the GNU Lesser Public License (LGPL), with some -// exclusions (see below). This basically means that you can get the full source -// code for nothing, so long as you adhere to a few rules. -// -// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you -// require, as long as you: -// -// Pass on the (modified) YUNI source code with your software, with original -// copyrights intact : -// * If you distribute electronically, the source can be a separate download -// (either from your own site if you modified YUNI, or to the official YUNI -// website if you used an unmodified version) – just include a link in your -// documentation -// * If you distribute physical media, the YUNI source that you used to build -// your application should be included on that media -// Make it clear where you have customised it. -// -// In addition to the LGPL license text, the following exceptions / clarifications -// to the LGPL conditions apply to YUNI: -// -// * Making modifications to YUNI configuration files, build scripts and -// configuration headers such as yuni/platform.h in order to create a -// customised build setup of YUNI with the otherwise unmodified source code, -// does not constitute a derived work -// * Building against YUNI headers which have inlined code does not constitute a -// derived work -// * Code which subclasses YUNI classes outside of the YUNI libraries does not -// form a derived work -// * Statically linking the YUNI libraries into a user application does not make -// the user application a derived work. -// * Using source code obsfucation on the YUNI source code when distributing it -// is not permitted. -// As per the terms of the LGPL, a "derived work" is one for which you have to -// distribute source code for, so when the clauses above define something as not -// a derived work, it means you don't have to distribute source code for it. -// However, the original YUNI source code with all modifications must always be -// made available. - -#pragma once -#define YUNI_OS_WINDOWS -#define YUNI_HAS_CPP_MOVE -#define YUNI_DECL - -#include - - - -namespace Yuni -{ - - /*! - ** \brief Mechanism to avoid the simultaneous use of a common resource - ** - ** \ingroup Threads - */ - class YUNI_DECL Mutex final - { - public: - /*! - ** \brief A class-level locking mechanism - ** - ** A class-level locking operation locks all objects in a given class during that operation - */ - template - class ClassLevelLockable - { - public: - //! A dedicated mutex for the class T - static Mutex mutex; - - }; // class ClassLevelLockable - - - public: - //! \name Constructor & Destructor - //@{ - /*! - ** \brief Default constructor - ** - ** Recursive by default to keep homogeneous behavior between - ** platforms. - */ - explicit Mutex(bool recursive = true); - /*! - ** \brief Copy constructor - ** - ** This constructor does actually nothing but it allows the compilation - ** of other classes which would implement a copy constructor - */ - Mutex(const Mutex&); - - # ifdef YUNI_HAS_CPP_MOVE - // an OS's native mutex must have invariant address and thus can not be moved - Mutex(Mutex&&) = delete; - #endif - - /*! - ** \brief Destructor - */ - ~Mutex(); - //@} - - //! \name Lock & Unlock - //@{ - /*! - ** \brief Lock the mutex - */ - void lock(); - - /*! - ** \brief Try to lock the mutex - ** - ** \return True if the mutex has been locked, false otherwise - */ - bool trylock(); - - /*! - ** \brief Release the lock - */ - void unlock(); - //@} - - # ifndef YUNI_NO_THREAD_SAFE - # ifndef YUNI_OS_WINDOWS - //! \name Native - //@{ - //! Get the original PThread mutex - ::pthread_mutex_t& pthreadMutex(); - //! Get the original PThread mutex (const) - const ::pthread_mutex_t& pthreadMutex() const; - //@} - # endif - # endif - - - //! \name Operators - //@{ - //! Operator = (do nothing) - Mutex& operator = (const Mutex&); - # ifdef YUNI_HAS_CPP_MOVE - // an OS's native mutex must have invariant address and thus can not be moved - Mutex& operator = (Mutex&&) = delete; - #endif - //@} - - - private: - //! Destroy the current mutex - inline void destroy(); - //! Create the mutex with settings from another mutex - inline void copy(const Mutex& rhs); - - private: - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - //! The critical section - CRITICAL_SECTION pSection; - # else - //! The PThread mutex - ::pthread_mutex_t pLock; - ::pthread_mutexattr_t pAttr; - # endif - # endif - - }; // class Mutex - - - - - /*! - ** \brief Locks a mutex in the constructor and unlocks it in the destructor (RAII). - ** - ** This class is especially usefull for `get` accessor` and/or returned values - ** which have to be thread-safe. - ** This is a very common C++ idiom, known as "Resource Acquisition Is Initialization" (RAII). - ** - ** \code - ** class Foo - ** { - ** public: - ** Foo() : pValue(42) {} - ** ~Foo() {} - ** int getValue() - ** { - ** MutexLocker locker(pMutex); - ** return pValue; - ** } - ** void setValue(const int i) - ** { - ** pMutex.lock(); - ** pValue = i; - ** pMutex.unlock(); - ** } - ** private: - ** int pValue; - ** Mutex pMutex; - ** }; - ** \endcode - */ - class MutexLocker final - { - public: - //! \name Constructor & Destructor - //@{ - /*! - ** \brief Constructor - ** - ** \param m The mutex to lock - */ - MutexLocker(Mutex& m); - //! Destructor - ~MutexLocker(); - //@} - - MutexLocker& operator = (const MutexLocker&) = delete; - - private: - //! Reference to the real mutex - Mutex& pMutex; - - }; // MutexLocker - - - - - //! All mutexes for each class - template Mutex Mutex::ClassLevelLockable::mutex; - - - - -} // namespace Yuni - -# include "mutex.hxx" diff --git a/PowerEditor/src/MISC/Common/mutex.hxx b/PowerEditor/src/MISC/Common/mutex.hxx deleted file mode 100644 index 2d0c3810a47..00000000000 --- a/PowerEditor/src/MISC/Common/mutex.hxx +++ /dev/null @@ -1,116 +0,0 @@ -// YUNI's default license is the GNU Lesser Public License (LGPL), with some -// exclusions (see below). This basically means that you can get the full source -// code for nothing, so long as you adhere to a few rules. - -// Under the LGPL you may use YUNI for any purpose you wish, and modify it if you -// require, as long as you: -// -// Pass on the (modified) YUNI source code with your software, with original -// copyrights intact : -// * If you distribute electronically, the source can be a separate download -// (either from your own site if you modified YUNI, or to the official YUNI -// website if you used an unmodified version) – just include a link in your -// documentation -// * If you distribute physical media, the YUNI source that you used to build -// your application should be included on that media -// Make it clear where you have customised it. -// -// In addition to the LGPL license text, the following exceptions / clarifications -// to the LGPL conditions apply to YUNI: -// -// * Making modifications to YUNI configuration files, build scripts and -// configuration headers such as yuni/platform.h in order to create a -// customised build setup of YUNI with the otherwise unmodified source code, -// does not constitute a derived work -// * Building against YUNI headers which have inlined code does not constitute a -// derived work -// * Code which subclasses YUNI classes outside of the YUNI libraries does not -// form a derived work -// * Statically linking the YUNI libraries into a user application does not make -// the user application a derived work. -// * Using source code obsfucation on the YUNI source code when distributing it -// is not permitted. -// As per the terms of the LGPL, a "derived work" is one for which you have to -// distribute source code for, so when the clauses above define something as not -// a derived work, it means you don't have to distribute source code for it. -// However, the original YUNI source code with all modifications must always be -// made available. - -#pragma once -#include "mutex.h" - - - -namespace Yuni -{ - - inline void Mutex::lock() - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - EnterCriticalSection(&pSection); - # else - ::pthread_mutex_lock(&pLock); - # endif - # endif - } - - - inline bool Mutex::trylock() - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - return (0 != TryEnterCriticalSection(&pSection)); - # else - return (0 == ::pthread_mutex_trylock(&pLock)); - # endif - # else - return false; - # endif - } - - - inline void Mutex::unlock() - { - # ifndef YUNI_NO_THREAD_SAFE - # ifdef YUNI_OS_WINDOWS - LeaveCriticalSection(&pSection); - # else - ::pthread_mutex_unlock(&pLock); - # endif - # endif - } - - - # ifndef YUNI_NO_THREAD_SAFE - # ifndef YUNI_OS_WINDOWS - inline pthread_mutex_t& Mutex::pthreadMutex() - { - return pLock; - } - - inline const pthread_mutex_t& Mutex::pthreadMutex() const - { - return pLock; - } - # endif - # endif - - - - inline MutexLocker::MutexLocker(Mutex& m) : - pMutex(m) - { - m.lock(); - } - - - inline MutexLocker::~MutexLocker() - { - pMutex.unlock(); - } - - - - -} // namespace Yuni diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b1b9e5208e4..cde1e68d739 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -48,7 +48,6 @@ #include "documentMap.h" #include "functionListPanel.h" #include "fileBrowser.h" -#include "LongRunningOperation.h" #include "Common.h" using namespace std; @@ -1496,9 +1495,11 @@ void Notepad_plus::getMatchedFileNames(const TCHAR *dir, const vector lock(replaceInFiles_mutex); const TCHAR *dir2Search = _findReplaceDlg.getDir2Search(); if (!dir2Search[0] || !::PathFileExists(dir2Search)) @@ -2165,9 +2166,11 @@ void Notepad_plus::copyMarkedLines() str2Cliboard(globalStr); } +std::mutex mark_mutex; + void Notepad_plus::cutMarkedLines() { - LongRunningOperation op; + std::lock_guard lock(mark_mutex); int lastLine = _pEditView->lastZeroBasedLineNumber(); generic_string globalStr = TEXT(""); @@ -2189,7 +2192,7 @@ void Notepad_plus::cutMarkedLines() void Notepad_plus::deleteMarkedLines(bool isMarked) { - LongRunningOperation op; + std::lock_guard lock(mark_mutex); int lastLine = _pEditView->lastZeroBasedLineNumber(); @@ -2204,7 +2207,7 @@ void Notepad_plus::deleteMarkedLines(bool isMarked) void Notepad_plus::pasteToMarkedLines() { - LongRunningOperation op; + std::lock_guard lock(mark_mutex); int clipFormat; clipFormat = CF_UNICODETEXT; diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 1288241b1a7..76b80fed2aa 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -38,16 +38,16 @@ #include "fileBrowser.h" #include "Sorters.h" #include "verifySignedFile.h" -#include "LongRunningOperation.h" #include "md5.h" #include "sha-256.h" using namespace std; +std::mutex command_mutex; void Notepad_plus::macroPlayback(Macro macro) { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _playingBackMacro = true; _pEditView->execute(SCI_BEGINUNDOACTION); @@ -258,7 +258,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_UNDO: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(WM_UNDO); checkClipboard(); checkUndoState(); @@ -267,7 +267,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_REDO: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(SCI_REDO); checkClipboard(); checkUndoState(); @@ -345,7 +345,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_PASTE: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); int eolMode = int(_pEditView->execute(SCI_GETEOLMODE)); _pEditView->execute(SCI_PASTE); _pEditView->execute(SCI_CONVERTEOLS, eolMode); @@ -354,7 +354,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_PASTE_BINARY: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); if (!IsClipboardFormatAvailable(CF_TEXT)) return; @@ -510,7 +510,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_PASTE_AS_RTF: case IDM_EDIT_PASTE_AS_HTML: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF); if (!IsClipboardFormatAvailable(f)) @@ -553,7 +553,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING: case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); size_t fromLine = 0, toLine = 0; size_t fromColumn = 0, toColumn = 0; @@ -1495,7 +1495,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_TRIMTRAILING: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(SCI_BEGINUNDOACTION); doTrim(lineTail); @@ -1505,7 +1505,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_TRIMLINEHEAD: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(SCI_BEGINUNDOACTION); doTrim(lineHeader); @@ -1515,7 +1515,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_TRIM_BOTH: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(SCI_BEGINUNDOACTION); doTrim(lineTail); @@ -1533,7 +1533,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_TRIMALL: { - LongRunningOperation op; + std::lock_guard lock(command_mutex); _pEditView->execute(SCI_BEGINUNDOACTION); doTrim(lineTail); @@ -2154,7 +2154,7 @@ void Notepad_plus::command(int id) if (not buf->isReadOnly()) { - LongRunningOperation op; + std::lock_guard lock(command_mutex); buf->setEolFormat(newFormat); _pEditView->execute(SCI_CONVERTEOLS, static_cast(buf->getEolFormat())); } diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index e0e6dc68d24..eca50d55f07 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -36,7 +36,6 @@ #include "ScintillaEditView.h" #include "EncodingMapper.h" #include "uchardet.h" -#include "LongRunningOperation.h" static const int blockSize = 128 * 1024 + 4; static const int CR = 0x0D; @@ -798,9 +797,12 @@ For untitled document (new 4) In the current session, Notepad++ 1. track UNTITLED_NAME@CREATION_TIMESTAMP (backup\new 4@198776) in session.xml. */ + +std::mutex backup_mutex; + bool FileManager::backupCurrentBuffer() { - LongRunningOperation op; + std::lock_guard lock(backup_mutex); Buffer* buffer = _pNotepadPlus->getCurrentBuffer(); bool result = false; @@ -951,9 +953,11 @@ bool FileManager::deleteBufferBackup(BufferID id) return result; } +std::mutex save_mutex; + bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, generic_string * error_msg) { - LongRunningOperation op; + std::lock_guard lock(save_mutex); Buffer* buffer = getBufferByID(id); bool isHiddenOrSys = false; diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 78e9ba1fe06..9816fcd8aae 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -31,7 +31,6 @@ #include "ScintillaEditView.h" #include "Notepad_plus_msgs.h" #include "UniConversion.h" -#include "LongRunningOperation.h" #include "localization.h" using namespace std; @@ -772,6 +771,8 @@ void FindReplaceDlg::resizeDialogElements(LONG newWidth) } } +std::mutex findOps_mutex; + INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -1086,7 +1087,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case IDREPLACE : { - LongRunningOperation op; + std::lock_guard lock(findOps_mutex); + if (_currentStatus == REPLACE_DLG) { setStatusbarMessage(TEXT(""), FSNoMessage); @@ -1169,7 +1171,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case IDD_FINDINFILES_REPLACEINFILES : { - LongRunningOperation op; + std::lock_guard lock(findOps_mutex); + setStatusbarMessage(TEXT(""), FSNoMessage); const int filterSize = 256; TCHAR filters[filterSize]; @@ -1209,7 +1212,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case IDC_REPLACE_OPENEDFILES : { - LongRunningOperation op; + std::lock_guard lock(findOps_mutex); + if (_currentStatus == REPLACE_DLG) { setStatusbarMessage(TEXT(""), FSNoMessage); @@ -1229,7 +1233,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM case IDREPLACEALL : { - LongRunningOperation op; + std::lock_guard lock(findOps_mutex); + if (_currentStatus == REPLACE_DLG) { setStatusbarMessage(TEXT(""), FSNoMessage); diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 3bfde445f9b..4a73cb22ca7 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -40,7 +40,6 @@ #include "Processus.h" #include "PluginsManager.h" #include "verifySignedFile.h" -#include "LongRunningOperation.h" #define TEXTFILE 256 #define IDR_PLUGINLISTJSONFILE 101 diff --git a/PowerEditor/visual.net/notepadPlus.vcxproj b/PowerEditor/visual.net/notepadPlus.vcxproj index b7f9017372b..2cc3f35735a 100755 --- a/PowerEditor/visual.net/notepadPlus.vcxproj +++ b/PowerEditor/visual.net/notepadPlus.vcxproj @@ -272,8 +272,6 @@ copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml - - @@ -538,9 +536,6 @@ copy ..\src\contextMenu.xml ..\bin64\contextMenu.xml - - -