From 3cb047e15953d4532dd12ffcbfd0d192a94c86b6 Mon Sep 17 00:00:00 2001 From: wangcong Date: Wed, 16 Jun 2021 15:58:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=20=20=E5=85=B3=E9=97=AD=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E7=95=8C=E9=9D=A2=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 点击识别界面的关闭按钮,识别界面奔溃 Log: 与主窗口有关 Change-Id: I0961360eb7a49d6bd5b34895f388cb390e32f26d --- src/mainwidget.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index f7941e9..7f93fb3 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -76,10 +76,6 @@ MainWidget::~MainWidget() m_tipIconLabel->deleteLater(); m_tipIconLabel = nullptr; } - if (m_currentImg) { - delete m_currentImg; - m_currentImg = nullptr; - } } @@ -254,29 +250,20 @@ void MainWidget::loadingUi() void MainWidget::openImage(const QString &path) { - createLoadingUi(); if (m_imageview) { QImage img(path); m_imageview->openFilterImage(img); m_imageview->fitWindow(); m_imgName = path; + openImage(img); } - if (!m_loadImagethread) { - m_loadImagethread = QThread::create([ = ]() { - QMutexLocker locker(&m_mutex); - m_result = TessOcrUtils::instance()->getRecogitionResult(path, ResultType::RESULT_STRING); - emit sigResult(m_result.result); - }); - } - - connect(m_loadImagethread, &QThread::finished, m_loadImagethread, &QObject::deleteLater); - m_loadImagethread->start(); } void MainWidget::openImage(const QImage &img) { + createLoadingUi(); if (m_imageview) { m_imageview->openFilterImage(img); m_imageview->fitWindow();