Summary: | Cancel button doesn't work when items are being processed | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Smit Mehta <smit.meh> |
Component: | Faces-RedEyes | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | aspotashev, caulier.gilles, metzpinguin, omar.moh.amin |
Priority: | NOR | ||
Version: | 5.1.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/digikam/6849adf429369d97c9fc421f1d01dd9d55c70c2e | Version Fixed In: | 5.2.0 |
Sentry Crash Report: |
Description
Smit Mehta
2012-04-04 10:45:13 UTC
removeredeyeswindow.cpp::line 720. cancelClicked() signal is not connected... Gilles Caulier Hi Gilles I dont think thats the problem. First of all the lines 719-721 are useless as there is no "Cancel" button declared. We always deal with "Close" throughout the code. Also, once the process starts, setBusy(true) is called, which sets the slots for myCloseClicked() properly. And connection is fine as I see, because the mouse cursor changes when we click it. There should be some problem with the thread. Smit Thread must be canceled at line 506 Look in WorkerThread::cancel() : pd->cancel is switched to true. This affect Task::run() to be returned if a NEW task is started. It do not stop any ld->runtype action in fact. I suspect that operation will be canceled when current image processed will be done. Can you confirm ? Gilles Caulier Hi Gilles No, the thread doesnt get canceled after current image also. I just tried with 4 images, and canceled it after 1st image, but the thread still completes all the 4 images. Smit Don't forget that WorkedThread use paralelization thread class based on KDE ThreadWeaver. This want mean that more than one image will be proecessed at the same time. On my i5 computer i can process 4 images at the same time with JPEGLossLess tool which is also based on ThreadWeaver. We need to implement operation cancelization into sub image processing classes of remove red eyes... Gilles Caulier Hi Gilles Okay, I tested it again with 50 images. On canceling, it gets canceled after processing 5 images. How can we implement cancel operation into sub image processing classes of remove red eyes? Can you tell me to look for some other code/tool where similar thing is already implemented? Smit Smit, I take a look into RedEyesRemoval tool source code to see how it's implemented. Look like the object used to process image is Locator : https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.h#L117 It's called by 3 possible operations provided by tool : https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L99 https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L108 https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/plugin/workerthread.cpp#L113 To be able to stop Locator operation, cancel variable need to be shared with Locator instance. We can pass cancel memory address to Locator instance by a dedicated method. In Locator implementation, here haarclassifierlocator class : https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/removeredeyes/detection/locators/haarclassifier/haarclassifierlocator.cpp ... we need to check if cancel address content pass to true in each processing loop to cancel computations. I use this technic into KPWriteImage class to be able to cancel writing image data to file : https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/common/libkipiplugins/tools/imageio/kpwriteimage.h#L71 Gilles Caulier Maik, In my previous comment i explain how to fix the problem... Gilles This problem still valid with new red-eyes correction filter implemented in digiKam core and used in BQM. The filter implementation do not permit to cancel operation. It require only few lines of code to do in loop control. Very easy to fix now compared to obsolete kipi tool. Gilles Caulier Git commit 6849adf429369d97c9fc421f1d01dd9d55c70c2e by Maik Qualmann. Committed on 20/08/2016 at 20:24. Pushed by mqualmann into branch 'master'. add cancel function to BQM red eye correction tool M +2 -1 NEWS M +11 -8 libs/facesengine/redeye/redeyecorrectionfilter.cpp M +17 -4 utilities/queuemanager/tools/enhance/redeyecorrection.cpp M +7 -0 utilities/queuemanager/tools/enhance/redeyecorrection.h http://commits.kde.org/digikam/6849adf429369d97c9fc421f1d01dd9d55c70c2e Git commit 1e4c8e99c3d88423dd491136f6edb5d74afae0f1 by Maik Qualmann. Committed on 23/08/2016 at 10:28. Pushed by mqualmann into branch 'master'. fix cancel DImg filter when the filter is started directly M +3 -1 libs/threads/dynamicthread.cpp http://commits.kde.org/digikam/1e4c8e99c3d88423dd491136f6edb5d74afae0f1 |