From 55cc71608bf9e7ebb68909c948382ff3ee443d16 Mon Sep 17 00:00:00 2001 From: Hombre Date: Tue, 3 Sep 2019 22:10:04 +0200 Subject: [PATCH 1/7] Converting Glib's mutex (obsolete) to std::mutex (no issue) --- rtgui/guiutils.cc | 53 -------------------------------------- rtgui/threadutils.cc | 25 +++++++++--------- rtgui/threadutils.h | 28 +++++--------------- rtgui/thumbimageupdater.cc | 22 ++++++++-------- 4 files changed, 31 insertions(+), 97 deletions(-) diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index ec0bf6588..48a01f040 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -83,59 +83,6 @@ void IdleRegister::destroy() mutex.unlock(); } -/* -gboolean giveMeAGo(void* data) { - GThreadLock *threadMutex = static_cast(data); - printf("A\n"); - Glib::Threads::Mutex::Lock GUILock(threadMutex->GUI); - printf("B\n"); - { - Glib::Threads::Mutex::Lock operationLock(threadMutex->operation); - printf("C\n"); - - threadMutex->operationCond.signal(); - printf("D\n"); - operationLock.release(); // because we're not sure that "lock" destructor happens here... - } - threadMutex->GUICond.wait(threadMutex->GUI); - printf("E\n"); - - GUILock.release(); - - return false; -} - -GThreadLock::GThreadLock() : sameThread(false) { - if (Glib::Threads::Thread::self() == mainThread) { - sameThread = true; - return; - } - - printf("10\n"); - { - Glib::Threads::Mutex::Lock operationLock(operation); - - printf("20\n"); - gdk_threads_add_idle(giveMeAGo, this); - - printf("30\n"); - operationCond.wait(operation); - printf("40\n"); - operationLock.release(); - } -} - -GThreadLock::~GThreadLock() { - if (!sameThread) { - printf("50\n"); - Glib::Threads::Mutex::Lock lock(GUI); - printf("60\n"); - GUICond.signal(); - printf("Fin\n"); - } -} -*/ - Glib::ustring escapeHtmlChars(const Glib::ustring &src) { diff --git a/rtgui/threadutils.cc b/rtgui/threadutils.cc index 7ba296081..4f8190c36 100644 --- a/rtgui/threadutils.cc +++ b/rtgui/threadutils.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ #include "threadutils.h" +#include #include #include @@ -67,7 +68,7 @@ void MyReaderLock::acquire () return; } - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); if (mutex.writerCount == 0) { // There's no writer operating, we can increment the writer count which will lock writers. @@ -95,7 +96,7 @@ void MyReaderLock::release () return; } - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // decrement the writer number first... --mutex.readerCount; @@ -105,7 +106,7 @@ void MyReaderLock::release () --mutex.writerCount; // ...and signal the next waiting reader/writer that it's free - mutex.cond.broadcast (); + mutex.cond.notify_one(); // notify_all ? } locked = false; @@ -117,7 +118,7 @@ void MyWriterLock::acquire () return; } - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // The writer count is not zero, so we have to wait for it to be zero again... while (mutex.writerCount != 0) { @@ -136,12 +137,12 @@ void MyWriterLock::release () return; } - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // Decrement the writer number first... if (--mutex.writerCount == 0) { // ...and if the writer count is zero again, we can wake up the next writer or reader. - mutex.cond.broadcast (); + mutex.cond.notify_one(); // notify_all ? } locked = false; @@ -170,7 +171,7 @@ void MyReaderLock::acquire (const char* file, int line) trace (file, line) << "Acquiring MyReaderLock..." << std::endl; - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); if (mutex.writerCount == 0) { // There's no writer operating, we can increment the writer count which will lock writers. @@ -211,7 +212,7 @@ void MyReaderLock::release (const char* file, int line) trace (file, line) << "Releasing MyReaderLock..." << std::endl; - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // decrement the writer number first... --mutex.readerCount; @@ -221,7 +222,7 @@ void MyReaderLock::release (const char* file, int line) --mutex.writerCount; // ...and signal the next waiting reader/writer that it's free - mutex.cond.broadcast (); + mutex.cond.notify_one(); // notify_all ? mutex.ownerThread = nullptr; mutex.lastWriterFile = ""; @@ -241,7 +242,7 @@ void MyWriterLock::acquire (const char* file, int line) trace (file, line) << "Acquiring MyWriterLock..." << std::endl; - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // The writer count is not zero, so we have to wait for it to be zero again... while (mutex.writerCount != 0) { @@ -273,12 +274,12 @@ void MyWriterLock::release (const char* file, int line) trace (file, line) << "Releasing MyWriterLock..." << std::endl; - Glib::Threads::Mutex::Lock lock (mutex.mutex); + std::lock_guard lock (mutex.mutex); // Decrement the writer number first... if (--mutex.writerCount == 0) { // ...and if the writer count is zero again, we can wake up the next writer or reader. - mutex.cond.broadcast (); + mutex.cond.notify_one(); // notify_all ? mutex.ownerThread = nullptr; mutex.lastWriterFile = ""; diff --git a/rtgui/threadutils.h b/rtgui/threadutils.h index 1215d53a1..f54cbb845 100644 --- a/rtgui/threadutils.h +++ b/rtgui/threadutils.h @@ -25,14 +25,14 @@ //#undef STRICT_MUTEX //#define STRICT_MUTEX 1 -#include - +#include +#include #include "../rtengine/noncopyable.h" #if STRICT_MUTEX && NDEBUG -using MyMutexBase = Glib::Threads::Mutex; +using MyMutexBase = std::mutex; #else -using MyMutexBase = Glib::Threads::RecMutex; +using MyMutexBase = std::recursive_mutex; #endif /** @@ -67,8 +67,6 @@ class MyMutex::MyLock : { public: explicit MyLock (MyMutex& mutex); - MyLock (MyMutex& mutex, Glib::Threads::NotLock); - MyLock (MyMutex& mutex, Glib::Threads::TryLock); ~MyLock (); @@ -92,8 +90,8 @@ public: friend class MyWriterLock; private: - Glib::Threads::Mutex mutex; - Glib::Threads::Cond cond; + std::mutex mutex; + std::condition_variable_any cond; std::size_t writerCount = 0; std::size_t readerCount = 0; @@ -168,7 +166,7 @@ inline void MyMutex::lock () inline bool MyMutex::trylock () { - if (MyMutexBase::trylock ()) { + if (MyMutexBase::try_lock ()) { #if STRICT_MUTEX && !NDEBUG checkLock (); #endif @@ -195,18 +193,6 @@ inline MyMutex::MyLock::MyLock (MyMutex& mutex) mutex.lock(); } -inline MyMutex::MyLock::MyLock (MyMutex& mutex, Glib::Threads::NotLock) - : mutex (mutex) - , locked (false) -{ -} - -inline MyMutex::MyLock::MyLock (MyMutex& mutex, Glib::Threads::TryLock) - : mutex (mutex) - , locked (mutex.trylock ()) -{ -} - inline MyMutex::MyLock::~MyLock () { if (locked) { diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index c0df751a5..590a7ae1c 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -83,9 +83,9 @@ public: Glib::ThreadPool* threadPool_; - // Need to be a Glib::Threads::Mutex because used in a Glib::Threads::Cond object... + // Need to be a std::mutex because used in a std::condition_variable_any object... // This is the only exceptions along with GThreadMutex (guiutils.cc), MyMutex is used everywhere else - Glib::Threads::Mutex mutex_; + std::mutex mutex_; JobList jobs_; @@ -93,7 +93,7 @@ public: bool inactive_waiting_; - Glib::Threads::Cond inactive_; + std::condition_variable_any inactive_; void processNextJob() @@ -101,7 +101,7 @@ public: Job j; { - Glib::Threads::Mutex::Lock lock(mutex_); + std::lock_guard lock(mutex_); // nothing to do; could be jobs have been removed if ( jobs_.empty() ) { @@ -164,10 +164,10 @@ public: } if ( --active_ == 0 ) { - Glib::Threads::Mutex::Lock lock(mutex_); + std::lock_guard lock(mutex_); if (inactive_waiting_) { inactive_waiting_ = false; - inactive_.broadcast(); + inactive_.notify_one(); // notify_all ? } } } @@ -196,7 +196,7 @@ void ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upg return; } - Glib::Threads::Mutex::Lock lock(impl_->mutex_); + std::lock_guard lock(impl_->mutex_); // look up if an older version is in the queue Impl::JobList::iterator i(impl_->jobs_.begin()); @@ -228,7 +228,7 @@ void ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener) DEBUG("removeJobs(%p)", listener); { - Glib::Threads::Mutex::Lock lock(impl_->mutex_); + std::lock_guard lock(impl_->mutex_); for( Impl::JobList::iterator i(impl_->jobs_.begin()); i != impl_->jobs_.end(); ) { if (i->listener_ == listener) { @@ -244,7 +244,7 @@ void ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener) while ( impl_->active_ != 0 ) { DEBUG("waiting for running jobs1"); { - Glib::Threads::Mutex::Lock lock(impl_->mutex_); + std::lock_guard lock(impl_->mutex_); impl_->inactive_waiting_ = true; impl_->inactive_.wait(impl_->mutex_); } @@ -256,7 +256,7 @@ void ThumbImageUpdater::removeAllJobs() DEBUG("stop"); { - Glib::Threads::Mutex::Lock lock(impl_->mutex_); + std::lock_guard lock(impl_->mutex_); impl_->jobs_.clear(); } @@ -264,7 +264,7 @@ void ThumbImageUpdater::removeAllJobs() while ( impl_->active_ != 0 ) { DEBUG("waiting for running jobs2"); { - Glib::Threads::Mutex::Lock lock(impl_->mutex_); + std::lock_guard lock(impl_->mutex_); impl_->inactive_waiting_ = true; impl_->inactive_.wait(impl_->mutex_); } From c6206ac3320542b76d51fea90ed5ca76aaaa7730 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Sun, 29 Dec 2019 10:55:21 +0100 Subject: [PATCH 2/7] Fix broken build, #5435 --- rtengine/profilestore.h | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/profilestore.h b/rtengine/profilestore.h index 460facb72..8cd5d2608 100644 --- a/rtengine/profilestore.h +++ b/rtengine/profilestore.h @@ -18,6 +18,7 @@ */ #pragma once +#include #include #include From 2149a2b35a7300db051519f8a14e993ce3d38a7d Mon Sep 17 00:00:00 2001 From: rubisetcie Date: Fri, 17 Mar 2023 21:47:38 +0100 Subject: [PATCH 3/7] =?UTF-8?q?Fixed=20typo=20"lominosit=C3=A9"=20->=20"lu?= =?UTF-8?q?minosit=C3=A9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtdata/languages/Francais | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index b7b2c7ec7..f4ef5a0db 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -2732,8 +2732,8 @@ TP_RGBCURVES_BLUE;B TP_RGBCURVES_CHANNEL;Canal TP_RGBCURVES_GREEN;V TP_RGBCURVES_LABEL;Courbes RVB -TP_RGBCURVES_LUMAMODE;Mode Lominosité -TP_RGBCURVES_LUMAMODE_TOOLTIP;Mode Lominosité permet de faire varier la contribution des canaux R, V et B à la luminosité de l'image, sans altérer les couleurs de l'image. +TP_RGBCURVES_LUMAMODE;Mode Luminosité +TP_RGBCURVES_LUMAMODE_TOOLTIP;Mode Luminosité permet de faire varier la contribution des canaux R, V et B à la luminosité de l'image, sans altérer les couleurs de l'image. TP_RGBCURVES_RED;R TP_ROTATE_DEGREE;Degré TP_ROTATE_LABEL;Rotation From 8e64057e23be8400d15bee941b365cbf58fd4092 Mon Sep 17 00:00:00 2001 From: Christian-Kr Date: Sun, 18 Jun 2023 12:54:45 +0200 Subject: [PATCH 4/7] Add .idea to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fc65c877c..2cae259ab 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .settings .directory .vscode +.idea CMakeCache.txt CMakeFiles From d912dd1e51171a23c31194bbf5982e7d9c717f68 Mon Sep 17 00:00:00 2001 From: Hombre57 Date: Tue, 4 Jul 2023 00:30:25 +0200 Subject: [PATCH 5/7] Ending conversion to std::thread and std::mutex --- rtgui/histogrampanel.cc | 6 ++-- rtgui/threadutils.cc | 61 +++++++++++++++++++++++--------------- rtgui/threadutils.h | 25 +++++++++------- rtgui/thumbimageupdater.cc | 14 ++++----- 4 files changed, 62 insertions(+), 44 deletions(-) diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 821f6f0be..b804218f5 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -1197,7 +1197,7 @@ void HistogramArea::update( break; case ScopeType::PARADE: case ScopeType::WAVEFORM: { - MyWriterLock wave_lock(wave_mutex); + MYWRITERLOCK(wave_lock, wave_mutex) waveform_scale = waveformScale; rwave = waveformRed; gwave = waveformGreen; @@ -1330,7 +1330,7 @@ void HistogramArea::updateBackBuffer () cr->unset_dash(); - MyReaderLock wave_lock(wave_mutex); + MYREADERLOCK(wave_lock, wave_mutex) if (valid && (scopeType == ScopeType::HISTOGRAM || scopeType == ScopeType::HISTOGRAM_RAW)) { bool rawMode = scopeType == ScopeType::HISTOGRAM_RAW; @@ -1447,7 +1447,7 @@ void HistogramArea::updateBackBuffer () } else if (scopeType == ScopeType::VECTORSCOPE_HC || scopeType == ScopeType::VECTORSCOPE_HS) { drawVectorscope(cr, w, h); } - wave_lock.release(); + MYREADERLOCK_RELEASE(wave_lock); // Draw the frame's border style->render_frame(cr, 0, 0, surface->get_width(), surface->get_height()); diff --git a/rtgui/threadutils.cc b/rtgui/threadutils.cc index f747510d3..9bc9cf35d 100644 --- a/rtgui/threadutils.cc +++ b/rtgui/threadutils.cc @@ -17,7 +17,6 @@ * along with RawTherapee. If not, see . */ #include "threadutils.h" -#include #include #include @@ -28,6 +27,8 @@ #if STRICT_MUTEX && !NDEBUG +MyMutex::MyMutex() : locked(false) {} + void MyMutex::checkLock () { if (locked) { @@ -62,13 +63,18 @@ void MyMutex::checkUnlock () #if !TRACE_MYRWMUTEX +MyRWMutex::MyRWMutex() : + writerCount(0), + readerCount(0) +{} + void MyReaderLock::acquire () { if (locked) { return; } - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); if (mutex.writerCount == 0) { // There's no writer operating, we can increment the writer count which will lock writers. @@ -77,7 +83,7 @@ void MyReaderLock::acquire () // The writer count is non null, but a reader can be the owner of the writer lock, // which will be the case if the reader count is not zero too. while (mutex.writerCount != 0) { - mutex.cond.wait(mutex.mutex); + mutex.cond.wait (lock); } // Then, we can increment the writer count. @@ -96,7 +102,7 @@ void MyReaderLock::release () return; } - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // decrement the writer number first... --mutex.readerCount; @@ -106,7 +112,7 @@ void MyReaderLock::release () --mutex.writerCount; // ...and signal the next waiting reader/writer that it's free - mutex.cond.notify_one(); // notify_all ? + mutex.cond.notify_all (); } locked = false; @@ -118,11 +124,11 @@ void MyWriterLock::acquire () return; } - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // The writer count is not zero, so we have to wait for it to be zero again... while (mutex.writerCount != 0) { - mutex.cond.wait (mutex.mutex); + mutex.cond.wait (lock); } // ...then we can increment the writer count. @@ -137,12 +143,12 @@ void MyWriterLock::release () return; } - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // Decrement the writer number first... if (--mutex.writerCount == 0) { - // ...and if the writer count is zero again, we can wake up the next writer or reader. - mutex.cond.notify_one(); // notify_all ? + // ...and if the writer count is zero again, we wake up all of the waiting writer or reader. + mutex.cond.notify_all (); } locked = false; @@ -155,13 +161,20 @@ namespace std::ostream& trace (const char* file, int line) { - const auto currentThread = Glib::Threads::Thread::self (); + const auto currentThread = std::this_thread::get_id(); return std::cout << currentThread << ":" << file << ":" << line << ": "; } } +MyRWMutex::MyRWMutex() : + lastWriterFile(nullptr), + lastWriterLine(0), + writerCount(0), + readerCount(0) +{} + void MyReaderLock::acquire (const char* file, int line) { if (locked) { @@ -171,7 +184,7 @@ void MyReaderLock::acquire (const char* file, int line) trace (file, line) << "Acquiring MyReaderLock..." << std::endl; - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); if (mutex.writerCount == 0) { // There's no writer operating, we can increment the writer count which will lock writers. @@ -185,13 +198,13 @@ void MyReaderLock::acquire (const char* file, int line) << "\tLast writer file: " << mutex.lastWriterFile << std::endl << "\tLast writer line: " << mutex.lastWriterLine << std::endl; - mutex.cond.wait(mutex.mutex); + mutex.cond.wait (lock); } // Then, we can increment the writer count. ++mutex.writerCount; - mutex.ownerThread = Glib::Threads::Thread::self (); + mutex.ownerThread = std::this_thread::get_id (); mutex.lastWriterFile = file; mutex.lastWriterLine = line; } @@ -212,7 +225,7 @@ void MyReaderLock::release (const char* file, int line) trace (file, line) << "Releasing MyReaderLock..." << std::endl; - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // decrement the writer number first... --mutex.readerCount; @@ -222,9 +235,9 @@ void MyReaderLock::release (const char* file, int line) --mutex.writerCount; // ...and signal the next waiting reader/writer that it's free - mutex.cond.notify_one(); // notify_all ? + mutex.cond.notify_all (); - mutex.ownerThread = nullptr; + mutex.ownerThread = std::thread::id(); mutex.lastWriterFile = ""; mutex.lastWriterLine = 0; } @@ -242,7 +255,7 @@ void MyWriterLock::acquire (const char* file, int line) trace (file, line) << "Acquiring MyWriterLock..." << std::endl; - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // The writer count is not zero, so we have to wait for it to be zero again... while (mutex.writerCount != 0) { @@ -251,13 +264,13 @@ void MyWriterLock::acquire (const char* file, int line) << "\tLast writer file: " << mutex.lastWriterFile << std::endl << "\tLast writer line: " << mutex.lastWriterLine << std::endl; - mutex.cond.wait (mutex.mutex); + mutex.cond.wait (lock); } // ...then we can increment the writer count. ++mutex.writerCount; - mutex.ownerThread = Glib::Threads::Thread::self (); + mutex.ownerThread = std::this_thread::get_id (); mutex.lastWriterFile = file; mutex.lastWriterLine = line; @@ -274,14 +287,14 @@ void MyWriterLock::release (const char* file, int line) trace (file, line) << "Releasing MyWriterLock..." << std::endl; - std::lock_guard lock (mutex.mutex); + std::unique_lock lock (mutex.mutex); // Decrement the writer number first... if (--mutex.writerCount == 0) { - // ...and if the writer count is zero again, we can wake up the next writer or reader. - mutex.cond.notify_one(); // notify_all ? + // ...and if the writer count is zero again, we wake up all of the waiting writer or reader. + mutex.cond.notify_all (); - mutex.ownerThread = nullptr; + mutex.ownerThread = std::thread::id(); mutex.lastWriterFile = ""; mutex.lastWriterLine = 0; } diff --git a/rtgui/threadutils.h b/rtgui/threadutils.h index cdf093b52..401660b93 100644 --- a/rtgui/threadutils.h +++ b/rtgui/threadutils.h @@ -25,6 +25,7 @@ //#define STRICT_MUTEX 1 #include +#include #include #include "../rtengine/noncopyable.h" @@ -54,8 +55,10 @@ public: void unlock (); #if STRICT_MUTEX && !NDEBUG + MyMutex(); + private: - bool locked = false; + bool locked; void checkLock (); void checkUnlock (); #endif @@ -88,18 +91,20 @@ public: friend class MyReaderLock; friend class MyWriterLock; + MyRWMutex(); + private: - std::mutex mutex; - std::condition_variable_any cond; - - std::size_t writerCount = 0; - std::size_t readerCount = 0; - #if TRACE_MYRWMUTEX - Glib::Threads::Thread* ownerThread = nullptr; - const char* lastWriterFile = ""; - int lastWriterLine = 0; + std::thread::id ownerThread; + const char* lastWriterFile; + int lastWriterLine; #endif + + std::mutex mutex; + std::condition_variable cond; + + std::size_t writerCount; + std::size_t readerCount; }; /** diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index 65958797e..d196fdca5 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -85,7 +85,7 @@ public: Glib::ThreadPool* threadPool_; - // Need to be a std::mutex because used in a std::condition_variable_any object... + // Need to be a std::mutex because used in a std::condition_variable object... // This is the only exceptions along with GThreadMutex (guiutils.cc), MyMutex is used everywhere else std::mutex mutex_; @@ -95,7 +95,7 @@ public: bool inactive_waiting_; - std::condition_variable_any inactive_; + std::condition_variable inactive_; void processNextJob() @@ -169,7 +169,7 @@ public: std::lock_guard lock(mutex_); if (inactive_waiting_) { inactive_waiting_ = false; - inactive_.notify_one(); // notify_all ? + inactive_.notify_all(); } } } @@ -246,9 +246,9 @@ void ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener) while ( impl_->active_ != 0 ) { DEBUG("waiting for running jobs1"); { - std::lock_guard lock(impl_->mutex_); + std::unique_lock lock(impl_->mutex_); impl_->inactive_waiting_ = true; - impl_->inactive_.wait(impl_->mutex_); + impl_->inactive_.wait(lock); } } } @@ -266,9 +266,9 @@ void ThumbImageUpdater::removeAllJobs() while ( impl_->active_ != 0 ) { DEBUG("waiting for running jobs2"); { - std::lock_guard lock(impl_->mutex_); + std::unique_lock lock(impl_->mutex_); impl_->inactive_waiting_ = true; - impl_->inactive_.wait(impl_->mutex_); + impl_->inactive_.wait(lock); } } } From 961c2d09d5c56e701a7559eb8c331292b6ccd5ac Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 2 Aug 2023 16:05:45 -0700 Subject: [PATCH 6/7] Mac bundle: handle harfbuzz update Harfbuzz was recently upgraded and it broke the default link to graphite. --- tools/osx/macosx_bundle.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index ca381ec14..d5dd71319 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -225,8 +225,11 @@ ModifyInstallNames 2>&1 # Copy libpng16 to the app bundle cp ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib" -# Copy libtiff 5 into the app bundle -cp ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" +# Copy graphite to Frameworks +cp ${LOCAL_PREFIX}/lib/libgraphite2.3.dylib "${CONTENTS}/Frameworks" + +# Copy libtiff 6 into the app bundle +cp ${LOCAL_PREFIX}/lib/libtiff.6.dylib "${CONTENTS}/Frameworks/libtiff.6.dylib" # Copy libomp to Frameworks cp ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" From 4f752154cf226d73c3c051c64eb822064b39d470 Mon Sep 17 00:00:00 2001 From: Hombre57 Date: Thu, 3 Aug 2023 20:12:52 +0200 Subject: [PATCH 7/7] Moving FileBrowserEntry static variable initialization to a dedicated method. Fixes a crash introduced by PR #5435. --- rtgui/filebrowserentry.cc | 19 +++++++++---------- rtgui/filebrowserentry.h | 2 +- rtgui/rtwindow.cc | 1 + 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index b89fe340d..7df29dd92 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -37,7 +37,6 @@ //extern Glib::Threads::Thread* mainThread; -bool FileBrowserEntry::iconsLoaded(false); Glib::RefPtr FileBrowserEntry::editedIcon; Glib::RefPtr FileBrowserEntry::recentlySavedIcon; Glib::RefPtr FileBrowserEntry::enqueuedIcon; @@ -58,15 +57,6 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname) scale = 1; - if (!iconsLoaded) { - editedIcon = RTImage::createPixbufFromFile ("tick-small.png"); - recentlySavedIcon = RTImage::createPixbufFromFile ("save-small.png"); - enqueuedIcon = RTImage::createPixbufFromFile ("gears-small.png"); - hdr = RTImage::createPixbufFromFile ("filetype-hdr.png"); - ps = RTImage::createPixbufFromFile ("filetype-ps.png"); - iconsLoaded = true; - } - thumbnail->addThumbnailListener (this); } @@ -90,6 +80,15 @@ FileBrowserEntry::~FileBrowserEntry () } } +void FileBrowserEntry::init () +{ + editedIcon = RTImage::createPixbufFromFile ("tick-small.png"); + recentlySavedIcon = RTImage::createPixbufFromFile ("save-small.png"); + enqueuedIcon = RTImage::createPixbufFromFile ("gears-small.png"); + hdr = RTImage::createPixbufFromFile ("filetype-hdr.png"); + ps = RTImage::createPixbufFromFile ("filetype-ps.png"); +} + void FileBrowserEntry::refreshThumbnailImage () { diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 67b953514..f8fca4db1 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -50,7 +50,6 @@ class FileBrowserEntry final : public ThumbBrowserEntryBase, { double scale; - static bool iconsLoaded; bool wasInside; ImageAreaToolListener* iatlistener; int press_x, press_y, action_x, action_y; @@ -80,6 +79,7 @@ public: FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname); ~FileBrowserEntry () override; + static void init (); void draw (Cairo::RefPtr cc) override; void setImageAreaToolListener (ImageAreaToolListener* l) diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index d588d6aa5..dcfc2f05c 100755 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -241,6 +241,7 @@ RTWindow::RTWindow () RTImage::init(); WhiteBalance::init(); MyExpander::init(); + FileBrowserEntry::init(); #ifndef WIN32 const std::vector> appIcons = {