屏保崩溃问题修复

This commit is contained in:
liudun 2024-02-23 15:29:35 +08:00
parent 367492e0dc
commit 526a633b61
1 changed files with 13 additions and 8 deletions

View File

@ -147,19 +147,24 @@ QString SCConfiguration::getDefaultBackground()
if(ispicture(backgroundFile)) {
return backgroundFile;
} else {
QString defaultBackground;
#ifdef KDKINFO_FOUND
char *systemName = kdk_system_get_systemName();
#else
char *systemName = "none";
#endif
char *systemName = nullptr; // 初始化为 nullptr
systemName = kdk_system_get_systemName();
if (systemName) {
if (QString(systemName) == "openKylin") {
free(systemName);
return "/usr/share/backgrounds/1-openkylin.jpg";
defaultBackground = "/usr/share/backgrounds/1-openkylin.jpg";
} else {
defaultBackground = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg";
}
} else {
defaultBackground = "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg";
}
free(systemName);
}
return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg";
#else
defaultBackground = "/usr/share/backgrounds/1-openkylin.jpg";
#endif
return defaultBackground;
}
}