refactor: Remove unused code

This was only used for Qt 5.8 on Win.
This commit is contained in:
Lars Toenning
2024-11-18 19:37:14 +01:00
parent 1a0b2a8c5f
commit d89af5316e
2 changed files with 1 additions and 30 deletions

View File

@@ -3,28 +3,6 @@
#include "misc/dbus.h"
#ifdef Q_OS_WIN
# include <qt_windows.h>
# include <QDBusConnection>
// https://blogs.msdn.microsoft.com/oldnewthing/20131105-00/?p=2733
// See https://bugreports.qt.io/browse/QTBUG-53031 for more details
// why this is necessary.
void preventQtDBusDllUnload()
{
// Only Qt 5.8.0 is affected.
if (qVersion() != QByteArray("5.8.0")) { return; }
static HMODULE dbusDll;
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
reinterpret_cast<LPCTSTR>(&QDBusConnection::staticMetaObject), &dbusDll);
Q_ASSERT(dbusDll);
}
#else
void preventQtDBusDllUnload() {}
#endif
QDBusArgument &operator<<(QDBusArgument &arg, const std::string &s)
{
arg.beginStructure();

View File

@@ -78,11 +78,4 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QFlags<T> &value)
return arg;
}
// *INDENT-ON*
//! Windows: prevents unloading of QtDBus shared library until the process is terminated.
//! QtDBus must have been loaded already by the calling process.
//! Does nothing on non-Windows platforms.
SWIFT_MISC_EXPORT void preventQtDBusDllUnload();
#endif // guard
#endif // SWIFT_MISC_DBUS_H