From 46fb39ef5ab5dff2d442ac382f0790afd265dc9d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 13 May 2020 14:32:08 +0200 Subject: [PATCH] Fix crash on macOS with -qtlibinfix'ed Qt When Qt is configured with -qtlibinfix Foo then the prefix determination code in QLibraryInfo crashed, because it still assumed the library name to be "QtCore". Fixes: QTBUG-83912 Pick-to: 5.15 Change-Id: I104e115ac6904fc0a04ac45d68d26d4e02aba721 Reviewed-by: Alexandru Croitor --- src/corelib/global/qlibraryinfo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 82c255348f..871b2071fd 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -534,7 +534,10 @@ static QString getRelocatablePrefix() #if defined(QT_STATIC) prefixPath = prefixFromAppDirHelper(); #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework) - auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore")); +#ifndef QT_LIBINFIX + #define QT_LIBINFIX "" +#endif + auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore" QT_LIBINFIX)); if (!qtCoreBundle) { // When running Qt apps over Samba shares, CoreFoundation will fail to find // the Resources directory inside the bundle, This directory is a symlink, @@ -547,7 +550,7 @@ static QString getRelocatablePrefix() auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i)); auto url = QCFType(CFBundleCopyBundleURL(bundle)); auto path = QCFType(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle)); - if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) { + if (CFStringHasSuffix(path, CFSTR("/QtCore" QT_LIBINFIX ".framework"))) { qtCoreBundle = bundle; break; }