Bug 293790 - Switching project while adding data to TM doesn't work
Summary: Switching project while adding data to TM doesn't work
Status: RESOLVED FIXED
Alias: None
Product: lokalize
Classification: Applications
Component: translation memory (show other bugs)
Version: 1.4
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Nick Shaforostoff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-10 18:19 UTC by Lasse Liehu
Modified: 2019-09-01 12:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lasse Liehu 2012-02-10 18:19:45 UTC
Version:           1.4 (KDE 4.8) (using Devel) 
OS:                Linux

Also happens when opening the same project again.

Reproducible: Always

Steps to Reproduce:
1. Open a project (with many files, for example l10n-kde4/[lang], so that adding doesn't finish immediately)
2. Click "Add to translation memory" from context menu
3. Open another project

2. can also be:
2a. Open "Manage translation memories"
2b. Create a new translation memory
2c. Add data to TM

Actual Results:  
The job seems to be running, but it doesn't progress anymore.

Expected Results:  
The job either cancels or continues to progress.
Comment 1 Adrián Chaves (Gallaecio) 2019-08-14 19:42:45 UTC
I’ve been able to verify that stopping them is the intended behavior: https://cgit.kde.org/lokalize.git/tree/src/project/project.cpp#n158 (“qCDebug(LOKALIZE_LOG) << "loading" << newProjectPath << "finishing tm jobs...";”)

I think the problem is that the line right before stops the threads where the underlying jobs are run, but the progress report job is never finished.
Comment 2 Adrián Chaves (Gallaecio) 2019-09-01 12:20:41 UTC
Git commit b5f5c8eb13f81702171ff2caae17d5e3e64b0026 by Adrián Chaves.
Committed on 01/09/2019 at 12:19.
Pushed by adrianchavesfernandez into branch 'master'.

Delete translation memory “meta” scan jobs when switching projects

Summary:
When you start an operation to add files to the translation memory of the current project, a “meta” job is created and registered in the system with KIO, so that there is a system-wide progress report.

When you switch to a different project before the process finishes, however, the process stops (as in stops progressing) but the notification continues, and needs to be manually stopped by the user.

The reason is that on project switch we are cancelling all the jobs that perform the actual scanning, but we are leaving the parent job responsible for reporting the total progress in memory.

The proposed changes aim to fix that.

I must say however that I do not consider myself a C++/Qt programmer, but rather a Python programmer. So please pay close attention to the code, in case I’m doing something silly. I’m also completely open to any kind of style feedback, including variable naming.

Test Plan: Tested manually.

Reviewers: shaforostoff, aacid, sdepiets, aspotashev

Reviewed By: aacid

Differential Revision: https://phabricator.kde.org/D23244

M  +1    -3    src/tm/jobs.h
M  +6    -4    src/tm/tmscanapi.cpp
M  +2    -0    src/tm/tmscanapi.h

https://commits.kde.org/lokalize/b5f5c8eb13f81702171ff2caae17d5e3e64b0026