1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Catch OpenCV errors

Should help with #1240
This commit is contained in:
tux3 2015-03-04 22:13:42 +01:00
parent ea7c3a9a80
commit 641fc8c776
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -30,6 +30,7 @@
#include <QFontDatabase>
#include <QMutexLocker>
#include <QProcess>
#include <opencv2/core/core.hpp>
#include <sodium.h>
@ -61,6 +62,14 @@ void myMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QStr
}
#endif
int opencvErrorHandler(int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void*)
{
qWarning() << "OpenCV: ERROR ("<<status<<") in "
<<file_name<<":"<<line<<":"<<func_name<<": "<<err_msg;
return 0;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@ -128,6 +137,8 @@ int main(int argc, char *argv[])
qDebug() << "built on: " << __TIME__ << __DATE__ << "(" << TIMESTAMP << ")";
qDebug() << "commit: " << GIT_VERSION << "\n";
cv::redirectError(opencvErrorHandler);
#ifdef Q_OS_MACX
if (qApp->applicationDirPath() != "/Applications/qtox.app/Contents/MacOS") {
qDebug() << "OS X: Not in Applications folder";