Skip to content

Commit 02d49c3

Browse files
committed
macOS: Fix broken bundled QCA library/plugins
Crash report: DB017CB3-F16D-494B-A53F-22C8A26657E2 2025-12-07 13:47:50 CopyQ-2025-12-07-134750.ips Exception: EXC_BAD_ACCESS Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000070 Registers: x0 = 0x0000000000000000 x1 = 0x000000016d304db8 x2 = 0x0000000000000030 x3 = 0x0000000000000002 x4 = 0x0000000000000002 x5 = 0x00000000000005a0 x6 = 0x0000600000e905a0 x7 = 0x0000000000000000 x8 = 0x0000000114e8b000 x9 = 0xc8ebac248bdc004d x10 = 0x0000000000000000 x11 = 0x0000000000000003 x12 = 0x000060000021e438 x13 = 0x00000000001ff800 x14 = 0x00000000000007fb x15 = 0x000000008c49b01f x16 = 0x0000000114e1ffc8 x17 = 0x000000008c69affb x18 = 0x0000000000000000 x19 = 0x0000000000000070 x20 = 0x0000000000000000 x21 = 0x0000600001588008 x22 = 0x0000600001588018 x23 = 0x000000010358f19e x24 = 0x0000000000000004 x25 = 0x0000600002b31dc8 x26 = 0x000000000000001d x27 = 0x0000600002b30620 x28 = 0x00000000ffffffff lr = 0x0000000114fe5774 cpsr = 0x0000000060001000 fp = 0x000000016d305290 sp = 0x000000016d305270 esr = 0x0000000092000006 pc = 0x0000000114e1ffec far = 0x0000000000000070 Frames: [/opt/homebrew/*/qca-qt6.framework/Versions/2/qca-qt6] 0x114df4000 + 0x2bfec (QCA::Global::get_logger() + 0x18) [/opt/homebrew/*/libqca-logger.dylib] 0x114fe0000 + 0x5774 (loggerProvider::createLogger(int, QString const&) + 0x78) [/opt/homebrew/*/libqca-logger.dylib] 0x114fe0000 + 0x55a8 (loggerProvider::loggerProvider() + 0xec) [/opt/homebrew/*/libqca-logger.dylib] 0x114fe0000 + 0x5324 (loggerPlugin::createProvider() + 0x1c) [/Volumes/VOLUME/CopyQ.app/Contents/Frameworks/qca-qt6.framework/Versions/2/qca-qt6] 0x10350c000 + 0x107f0 (QCA::ProviderItem::load(QString const&, QString*) + 0x60) [/Volumes/VOLUME/CopyQ.app/Contents/Frameworks/qca-qt6.framework/Versions/2/qca-qt6] 0x10350c000 + 0xf5a0 (QCA::ProviderManager::scan() + 0x8e0) [/Volumes/VOLUME/CopyQ.app/Contents/Frameworks/qca-qt6.framework/Versions/2/qca-qt6] 0x10350c000 + 0x29bc0 (QCA::Global::scan() + 0x48) [/Volumes/VOLUME/CopyQ.app/Contents/Frameworks/qca-qt6.framework/Versions/2/qca-qt6] 0x10350c000 + 0x29a98 (QCA::isSupported(QList<QString> const&, QString const&) + 0x180) [/Volumes/VOLUME/CopyQ.app/Contents/Frameworks/qca-qt6.framework/Versions/2/qca-qt6] 0x10350c000 + 0x29cf8 (QCA::isSupported(char const*, QString const&) + 0x5c) ... Assisted-by: Claude Code
1 parent 021bafd commit 02d49c3

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/common/encryption.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
#include <QFile>
1313
#include <QFileInfo>
1414
#include <QLoggingCategory>
15+
#include <QPluginLoader>
1516
#include <QSaveFile>
1617
#include <QStandardPaths>
1718
#include <QTimer>
1819
#include <QtCrypto>
20+
#include <QtCrypto/qcaprovider.h>
1921

2022
namespace {
2123

@@ -57,6 +59,44 @@ bool initializeQCA()
5759
static auto qcaInit = new QCA::Initializer();
5860
Q_UNUSED(qcaInit);
5961

62+
#ifdef Q_OS_MACOS
63+
// Manually load the bundled ossl plugin since we disabled automatic loading
64+
const QString appDir = QCoreApplication::applicationDirPath();
65+
const QString osslPluginPath = appDir + "/../PlugIns/crypto/libqca-ossl.dylib";
66+
67+
QPluginLoader pluginLoader(osslPluginPath);
68+
if (!pluginLoader.load()) {
69+
qCCritical(logCategory) << "Failed to load bundled ossl plugin:" << pluginLoader.errorString();
70+
return false;
71+
}
72+
73+
QObject *plugin = pluginLoader.instance();
74+
if (!plugin) {
75+
qCCritical(logCategory) << "Failed to get plugin instance";
76+
return false;
77+
}
78+
79+
QCAPlugin *qcaPlugin = qobject_cast<QCAPlugin*>(plugin);
80+
if (!qcaPlugin) {
81+
qCCritical(logCategory) << "Plugin does not implement QCAPlugin interface";
82+
return false;
83+
}
84+
85+
QCA::Provider *provider = qcaPlugin->createProvider();
86+
if (!provider) {
87+
qCCritical(logCategory) << "Failed to create provider from plugin";
88+
return false;
89+
}
90+
91+
if (!QCA::insertProvider(provider)) {
92+
qCCritical(logCategory) << "Failed to insert provider into QCA";
93+
delete provider;
94+
return false;
95+
}
96+
97+
qCDebug(logCategory) << "Successfully loaded bundled ossl plugin:" << provider->name();
98+
#endif
99+
60100
if ( !QCA::isSupported(encryptionCipher.data()) ) {
61101
qCCritical(logCategory) << "Cipher" << encryptionCipher << "not supported by QCA";
62102
logFeatures();

utils/github/test-macos.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ test "$("$executable" info has-global-shortcuts)" -eq "1"
2121
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
2222
defaults write -g NSWindowResizeTime -float 0.001
2323

24+
# FIXME: Test encryption first for now
25+
export COPYQ_TESTS_EXECUTABLE="$executable"
26+
export QCALOGGER_LEVEL=8 # Debug log level for QCA library
27+
./copyq-tests \
28+
tabEncryption \
29+
tabEncryptionPasswordNew \
30+
tabEncryptionPasswordCurrent \
31+
tabEncryptionPasswordRetry \
32+
tabEncryptionPasswordRetryFail \
33+
tabEncryptionLargeItems \
34+
tabEncryptionChangePassword
35+
2436
# Run tests (retry once on error).
2537
export COPYQ_TESTS_RERUN_FAILED=1
2638
export COPYQ_TESTS_SKIP_COMMAND_EDIT=1

0 commit comments

Comments
 (0)