mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09: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()
|
void VConfigManager::migrateIniFile()
|
||||||
{
|
{
|
||||||
const QString originalFolder = "tamlok";
|
const QString originalFolder = "tamlok";
|
||||||
|
@ -27,11 +27,16 @@ struct VColor
|
|||||||
QString rgb; // 'FFFFFF', without '#'
|
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
|
class VConfigManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VConfigManager();
|
VConfigManager();
|
||||||
~VConfigManager();
|
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
// Read config from the directory config json file into a QJsonObject.
|
// Read config from the directory config json file into a QJsonObject.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user