修复一处gio资源释放问题;
This commit is contained in:
parent
f356ca340a
commit
577d4f6050
|
@ -773,6 +773,7 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent) {
|
||||||
|
|
||||||
int FileUtils::openFile(QString &path, bool openInDir)
|
int FileUtils::openFile(QString &path, bool openInDir)
|
||||||
{
|
{
|
||||||
|
int res = -1;
|
||||||
if(openInDir) {
|
if(openInDir) {
|
||||||
QStringList list;
|
QStringList list;
|
||||||
list.append(path);
|
list.append(path);
|
||||||
|
@ -781,12 +782,12 @@ int FileUtils::openFile(QString &path, bool openInDir)
|
||||||
"org.freedesktop.FileManager1",
|
"org.freedesktop.FileManager1",
|
||||||
"ShowItems");
|
"ShowItems");
|
||||||
message.setArguments({list, "ukui-search"});
|
message.setArguments({list, "ukui-search"});
|
||||||
QDBusMessage res = QDBusConnection::sessionBus().call(message);
|
QDBusMessage messageRes = QDBusConnection::sessionBus().call(message);
|
||||||
if (QDBusMessage::ReplyMessage == res.ReplyMessage) {
|
if (QDBusMessage::ReplyMessage == messageRes.ReplyMessage) {
|
||||||
return 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Error! QDBusMessage reply error! ReplyMessage:" << res.ReplyMessage;
|
qDebug() << "Error! QDBusMessage reply error! ReplyMessage:" << messageRes.ReplyMessage;
|
||||||
return -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto file = wrapGFile(g_file_new_for_uri(QUrl::fromLocalFile(path).toString().toUtf8().constData()));
|
auto file = wrapGFile(g_file_new_for_uri(QUrl::fromLocalFile(path).toString().toUtf8().constData()));
|
||||||
|
@ -801,6 +802,7 @@ int FileUtils::openFile(QString &path, bool openInDir)
|
||||||
mimeType = g_file_info_get_attribute_string(fileInfo.get()->get(), "standard::fast-content-type");
|
mimeType = g_file_info_get_attribute_string(fileInfo.get()->get(), "standard::fast-content-type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GAppInfo *info = NULL;
|
GAppInfo *info = NULL;
|
||||||
/*
|
/*
|
||||||
|
@ -826,11 +828,14 @@ int FileUtils::openFile(QString &path, bool openInDir)
|
||||||
}
|
}
|
||||||
g_key_file_free (keyfile);
|
g_key_file_free (keyfile);
|
||||||
if(!G_IS_APP_INFO(info)) {
|
if(!G_IS_APP_INFO(info)) {
|
||||||
return -1;
|
res = -1;
|
||||||
}
|
} else {
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
return 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
|
g_object_unref(info);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileUtils::copyPath(QString &path)
|
bool FileUtils::copyPath(QString &path)
|
||||||
|
|
Loading…
Reference in New Issue