0
私はQFtpとFTPサーバーに.AVIファイルをアップロードしようとしています:QFtp.putへのこの呼び出しによってクラッシュが発生するのはなぜですか?
void MyFTP::recordingDone(QString &fileName){
remainingFiles.push_back(new QString(fileName));
commands[qftp.connectToHost(globalProperties.ftpServer)] = "connect to host";
commands[qftp.login(globalProperties.ftpUsername,globalProperties.ftpPassword)] = "login";
commands[qftp.cd("myapp")] = "cd myapp";
commands[qftp.cd("Videos")] = "cd videos";
QDir().cd(globalProperties.videoStorageLocation);
qDebug()<<"Opening "<<fileName<<endl;
if(QFile::exists(fileName)){
qDebug()<<"File exists"<<endl;
}
else{
qDebug()<<"File does not exist"<<endl;
}
QFile file(fileName);
qDebug()<<"putting"<<endl;
qftp.put(&file,fileName);
qDebug()<<"Closing ftp"<<endl;
qftp.close();
}
私は、コマンド完了信号に接続されているんだとデバッグ出力情報にスロットを使用して:
void TrusionFTP::ftpCommandDone(int id, bool error){
qDebug()<<"command: "<<commands[id]<<": "<<error;
if(error){
qDebug()<<qftp.errorString()<<endl;
if (qftp.hasPendingCommands()){
qDebug()<<"Pending commands"<<endl;
}
}
}
はここでクラッシュする前に、出力だ:私はFTP接続を閉じない場合
Opening "2012-Mar-06-12-19-57.avi"
File exists
putting
Closing ftp
command: "connect to host" : false
command: "login" : false
command: "cd trusion" : false
command: "cd videos" : false
クラッシュが発生します。ファイルは決してそれをサーバー上に作成しません。
これはQtの他の言語バインディング、特にガベージコレクション言語での使用にも当てはまります。 PythonのためのPyQt。使用されている 'QFile'や他の' QIODevice'オブジェクトへの参照を保持する必要があります。 – Archimedix