Merge pull request #1008 from manongjohn/fix_canon_importimage_crash

Fix Canon Import Image crash
This commit is contained in:
manongjohn 2022-06-21 06:36:28 -04:00 committed by GitHub
commit 58aa20695e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include "toonz/tscenehandle.h" #include "toonz/tscenehandle.h"
#include "toonz/tcamera.h" #include "toonz/tcamera.h"
#include "toonz/toonzscene.h" #include "toonz/toonzscene.h"
#include "tsystem.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QFile> #include <QFile>
@ -968,12 +969,26 @@ bool Canon::downloadImage(EdsBaseRef object) {
// write out the full res file // write out the full res file
if (!isRaw) { if (!isRaw) {
TFilePath parentDir =
TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(
TFilePath(StopMotion::instance()->m_filePath));
TFilePath tempFile = parentDir + "temp.jpg";
StopMotion::instance()->m_tempFile = tempFile.getQString();
QFile fullImage(StopMotion::instance()->m_tempFile); QFile fullImage(StopMotion::instance()->m_tempFile);
fullImage.open(QIODevice::WriteOnly); fullImage.open(QIODevice::WriteOnly);
QDataStream dataStream(&fullImage); QDataStream dataStream(&fullImage);
dataStream.writeRawData((const char*)jpgStreamData, jpgStreamSize); dataStream.writeRawData((const char*)jpgStreamData, jpgStreamSize);
fullImage.close(); fullImage.close();
} else { } else {
TFilePath parentDir =
TApp::instance()->getCurrentScene()->getScene()->decodeFilePath(
TFilePath(StopMotion::instance()->m_filePath));
TFilePath tempRaw = parentDir + "temp.cr2";
StopMotion::instance()->m_tempRaw = tempRaw.getQString();
QFile fullImage(StopMotion::instance()->m_tempRaw); QFile fullImage(StopMotion::instance()->m_tempRaw);
fullImage.open(QIODevice::WriteOnly); fullImage.open(QIODevice::WriteOnly);
QDataStream dataStream(&fullImage); QDataStream dataStream(&fullImage);

View file

@ -70,7 +70,6 @@ private:
int m_captureNumberOfFrames = 1; int m_captureNumberOfFrames = 1;
QString m_levelName = ""; QString m_levelName = "";
QString m_fileType = "jpg"; QString m_fileType = "jpg";
QString m_filePath = "+stopmotion";
QString m_frameInfoText = ""; QString m_frameInfoText = "";
QString m_infoColorName = ""; QString m_infoColorName = "";
QString m_frameInfoToolTip = ""; QString m_frameInfoToolTip = "";
@ -110,6 +109,7 @@ public:
bool m_isTimeLapse = false; bool m_isTimeLapse = false;
int m_reviewTimeDSec = 20; int m_reviewTimeDSec = 20;
bool m_isTestShot = false; bool m_isTestShot = false;
QString m_filePath = "+stopmotion";
QString m_tempFile, m_tempRaw; QString m_tempFile, m_tempRaw;
TXshSimpleLevel* m_sl; TXshSimpleLevel* m_sl;