Skip to content
Snippets Groups Projects
Commit 89869f87 authored by Burak Hançerli's avatar Burak Hançerli :headphones:
Browse files

Merge branch 'QDS-10490/crash-on-qrc-allocation' into 'master'

QDS-10490 Crash on QRC allocation

Closes QDS-10490

See merge request design-studio/cloud-services/design-viewer!5
parents f56f8df0 13ceeb32
No related branches found
No related tags found
1 merge request!5QDS-10490 Crash on QRC allocation
Pipeline #61505 passed
...@@ -65,11 +65,23 @@ QString DvBase::unpackProject(const QByteArray &project, bool extractZip) ...@@ -65,11 +65,23 @@ QString DvBase::unpackProject(const QByteArray &project, bool extractZip)
if (projectLocationDir.isEmpty()) { if (projectLocationDir.isEmpty()) {
if (extractZip) if (extractZip)
printLog("File could not be extracted. Trying to open it as a resource file."); printLog("File could not be extracted. Trying to open it as a resource file.");
const uchar *data = reinterpret_cast<const uchar *>(project.data());
printLog("Registering resource data. Size: " + QString::number(project.size())); const uchar *data;
if (m_projectData.size()) {
printLog("Unregistering the previous data from QRC system. Path: " + m_projectPath
+ " Size: " + QString::number(m_projectData.size()) + " bytes.");
data = reinterpret_cast<const uchar *>(m_projectData.data());
if (!QResource::unregisterResource(data, m_projectPath)) {
printErr("Cannot unregister the previous resource data.");
}
}
m_projectData = project;
data = reinterpret_cast<const uchar *>(m_projectData.data());
printLog("Registering resource data. Size: " + QString::number(m_projectData.size()));
const QString resourcePath{"/" + QString::number(QRandomGenerator::global()->generate())}; const QString resourcePath{"/" + QString::number(QRandomGenerator::global()->generate())};
// const QString resourcePath{"/qtdesignviewer"}; m_projectPath = resourcePath;
if (!QDir(resourcePath).removeRecursively()) { if (!QDir(resourcePath).removeRecursively()) {
printLog("Could not remove resource path: " + resourcePath); printLog("Could not remove resource path: " + resourcePath);
......
...@@ -56,6 +56,10 @@ protected: ...@@ -56,6 +56,10 @@ protected:
QString findFile(const QString &dir, const QString &filter); QString findFile(const QString &dir, const QString &filter);
void parseQmlprojectFile(const QString &fileName, QString *mainFile, QStringList *importPaths); void parseQmlprojectFile(const QString &fileName, QString *mainFile, QStringList *importPaths);
bool runProject(const QByteArray &projectData, const QString &projectName); bool runProject(const QByteArray &projectData, const QString &projectName);
private:
QByteArray m_projectData;
QString m_projectPath;
}; };
#endif // DV_BASE_H #endif // DV_BASE_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment