Le 04/08/2025 à 10:50, Koji Yokota a écrit :
commit ca2bf6c52e210c0b0da9eefc068c304f5877a500
Author: Koji Yokota <yok...@lyx.org>
Date:   Mon Aug 4 17:47:43 2025 +0900

     Use cache for color swatch display

Dear Koji,

Coverity Scan complains about the copying of form_->rc() in the code below (actually it advises using std::move(origrc), which we usually dismiss).

However, it seems strange to me that readTheme() would change the main rc like that. I think that it would be nice to either

1/ pass a LyXRC object as parameter of the function, or

2/change addTheme so that it does not update any rc object, and the update is done using its return value is done using its return value. It may be difficult since the themes are stored as something different to what LyXRC uses. This is unfortunate.

In the short term, I guess that solution 1/ is easier.

What do you think?

JMarc


@@ -1588,17 +1588,21 @@ void PrefColors::loadTheme(QListWidgetItem *item)
  void PrefColors::cacheAllThemes()
  {
        guiApp->setOverrideCursor(QCursor(Qt::WaitCursor));
+       themes_cache_.clear();
+       theme_names_cache_.clear();
+       // readTheme() changes form_->rc()
+       LyXRC origrc = form_->rc();
        for (int id = 0; id < themesLW->count(); ++id) {
                FileName const fn(fromqstr(theme_fullpaths_[id]));
-               themes_cache_.push_back(loadImportThemeCommon(fn, false));
+               themes_cache_.push_back(readTheme(fn));
                theme_names_cache_.push_back(themesLW->item(id)->text());
        }
+       form_->rc() = origrc;
        guiApp->restoreOverrideCursor();
  }

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to