diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index a7696719d1..3ae7e3bad8 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -152,15 +152,15 @@ class SystemRandom { static QBasicAtomicInt s_fdp1; // "file descriptor plus 1" static int openDevice(); + static __attribute__((destructor)) void closeDevice(); // assume GCC or a compiler able to understand GCC extensions SystemRandom() {} - ~SystemRandom(); public: enum { EfficientBufferFill = true }; static qssize_t fillBuffer(void *buffer, qssize_t count); }; QBasicAtomicInt SystemRandom::s_fdp1 = Q_BASIC_ATOMIC_INITIALIZER(0); -SystemRandom::~SystemRandom() +void SystemRandom::closeDevice() { int fd = s_fdp1.loadAcquire() - 1; if (fd >= 0)