Skip to content

Commit

Permalink
fix segfault on exit, some UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
skvark committed Feb 28, 2017
1 parent 1775cb5 commit 1275b4f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
27 changes: 21 additions & 6 deletions qml/pages/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,22 @@ Page {
enabled: idle

Image {
anchors.fill: parent
anchors {
top: label1.bottom
left: parent.left
right: parent.right
}
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "image://theme/icon-m-camera"
scale: 1.5
z: 30
}

Label {
id: label1
anchors.topMargin: 10;
anchors.bottomMargin: 10;
anchors.top: parent.top
width: parent.width
horizontalAlignment: Text.AlignHCenter
Expand All @@ -123,16 +128,21 @@ Page {
enabled: idle

Image {
anchors.fill: parent
anchors {
top: label2.bottom
left: parent.left
right: parent.right
}
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "image://theme/icon-l-image"
z: 30
}

Label {
id: label2
anchors.topMargin: 10;
anchors.bottomMargin: 10;
anchors.top: parent.top
width: parent.width
horizontalAlignment: Text.AlignHCenter
Expand Down Expand Up @@ -174,16 +184,21 @@ Page {
enabled: idle

Image {
anchors.fill: parent
anchors {
top: label3.bottom
left: parent.left
right: parent.right
}
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "image://theme/icon-l-document"
z: 30
}

Label {
id: label3
anchors.topMargin: 10;
anchors.bottomMargin: 10;
anchors.top: parent.top
width: parent.width
horizontalAlignment: Text.AlignHCenter
Expand Down
16 changes: 11 additions & 5 deletions src/tesseractapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,27 @@ TesseractAPI::TesseractAPI(QObject *parent) :

info_ = Info();
cancel_ = false;
run_at_least_once_ = false;
}

TesseractAPI::~TesseractAPI()
{
delete monitor_;
monitor_ = 0;
delete settingsManager_;
settingsManager_ = 0;
delete downloadManager_;
downloadManager_ = 0;
delete timer_;
timer_ = 0;

delete PDFhandler_;
PDFhandler_ = 0;
api_->End();
delete api_;
api_ = 0;

delete monitor_;
monitor_ = 0;
if(run_at_least_once_) {
api_->End();
api_ = 0;
}
}

void TesseractAPI::prepareForCropping(QString imagepath, int rotation, bool gallery) {
Expand Down Expand Up @@ -89,6 +93,7 @@ void TesseractAPI::analyze(QString imagepath, QVariant cropPoints)
// Periodically firing timer to get progress reports to the UI.
connect(timer_, SIGNAL(timeout()), this, SLOT(update()));
timer_->start(250);
run_at_least_once_ = true;
}

PDFThumbnailProvider *TesseractAPI::getThumbnailProvider() {
Expand Down Expand Up @@ -133,6 +138,7 @@ void TesseractAPI::analyzePDF(QList<int> pages)
// Periodically firing timer to get progress reports to the UI.
connect(timer_, SIGNAL(timeout()), this, SLOT(update()));
timer_->start(250);
run_at_least_once_ = true;
}

void TesseractAPI::cancel()
Expand Down
1 change: 1 addition & 0 deletions src/tesseractapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public slots:
QString rotatedPath_;
bool rotated_;
bool thumbsReady_;
bool run_at_least_once_;
unsigned int previousPage_;

ETEXT_DESC *monitor_;
Expand Down

0 comments on commit 1275b4f

Please sign in to comment.