mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: do not free userSettings and defaultSettings in destructor
Freeing userSettings and defaultSettings in the destructor of VConfigManager will cause crash in macOS.
This commit is contained in:
parent
b47982ab25
commit
e1befc1038
@ -33,16 +33,6 @@ VConfigManager::VConfigManager()
|
||||
{
|
||||
}
|
||||
|
||||
VConfigManager::~VConfigManager()
|
||||
{
|
||||
if (userSettings) {
|
||||
delete userSettings;
|
||||
}
|
||||
if (defaultSettings) {
|
||||
delete defaultSettings;
|
||||
}
|
||||
}
|
||||
|
||||
void VConfigManager::migrateIniFile()
|
||||
{
|
||||
const QString originalFolder = "tamlok";
|
||||
|
@ -27,11 +27,16 @@ struct VColor
|
||||
QString rgb; // 'FFFFFF', without '#'
|
||||
};
|
||||
|
||||
// FIXME: we do not free userSettings and defaultSettings here since there will
|
||||
// be only one global instance of VConfigManager. Freeing them in the destructor
|
||||
// causes crash in macOS.
|
||||
// One solution is to make the global variable a pointer, which causes too many
|
||||
// modifications. For now, we just choose the simple way.
|
||||
class VConfigManager
|
||||
{
|
||||
public:
|
||||
VConfigManager();
|
||||
~VConfigManager();
|
||||
|
||||
void initialize();
|
||||
|
||||
// Read config from the directory config json file into a QJsonObject.
|
||||
|
Loading…
x
Reference in New Issue
Block a user