From 327f7ed90dbcaad92511b962a8d1d14b46ef552a Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 19 May 2013 13:59:07 +0200 Subject: [PATCH] Seed Qt's random generator LyX uses QTemporaryFile to create a unique temporary directory. This temporary directory will consist of two random characters and the process identifier (PID). Currently, the two random characters are often the same because Qt's random generator was not seeded. If there are a lot of lyx temporary directories accumulated, the chance of failing to find a unique temporary directory is (N/100)%. The temporary directories can be left behind if either LyX crashes, or when a file in the temporary directory is opened in another viewer when LyX closes. This can be a pdf that is viewed in a reader that disallows the file to be removed while viewing it. --- src/frontends/qt4/GuiApplication.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 136b6e99fc..c319054803 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -946,6 +946,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv) QCoreApplication::setOrganizationDomain("lyx.org"); QCoreApplication::setApplicationName(lyx_package); + qsrand(QDateTime::currentDateTime().toTime_t()); + // Install translator for GUI elements. installTranslator(&d->qt_trans_); -- 2.39.2