11-20-2019, 12:39 PM | #16 |
Guru
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
The solution, though not perfect:
Code:
if (!m_process.waitForFinished(-1)) { m_process.kill(); m_process.waitForFinished(-1); } Because no message appears – the user may not know what to do at the moment because Sigil stops responding (Not Responded) when such windows are open. However, since Sigil will not crash – the editions it made before running the plugin will not be lost. If the problem only occurs in Windows (and in addition not all users), this may be due to processor speed or other factors. Maybe add a condition only for Windows? So although this is an extremely rare situation, it still protects your data from loss due to crash. |
11-20-2019, 12:49 PM | #17 |
Grand Sorcerer
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Steps to reproduce?
Clicking the X button should now literally be the same thing as clicking the Cancel button. So if it can crash clicking the X, you should be able to also get it to crash using the Cancel button. Last edited by DiapDealer; 11-20-2019 at 12:53 PM. |
Advert | |
|
11-20-2019, 12:52 PM | #18 |
Guru
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
Because TagMechanic crash relatively rarely, try FootnoteManipulator - crash almost every time you press X.
Edit: EpubCheck too. Last edited by BeckyEbook; 11-20-2019 at 01:01 PM. |
11-20-2019, 01:07 PM | #19 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
|
11-20-2019, 01:14 PM | #20 |
Guru
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
I tested 20 plugins and I consider the solution quite good. Sigil never crashed, there was not a single error message, even those that usually appeared after pressing "Cancel".
Hmmm ... It's worth doing more tests, but I'm pleasantly surprised. |
Advert | |
|
11-20-2019, 01:15 PM | #21 |
Sigil Developer
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
|
With the latest builds? I would guess this is a Windows only bug. In unix once you kill the process, it is gone and all of its windows go away.
I have no idea how that works in Windows but their must be so e way to kill an entire process! |
11-20-2019, 01:18 PM | #22 |
Sigil Developer
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
|
BeckyEbook, please create a Pull Request with your latest changes so I can see exactly what you are changing and where or post a diff -u here.
Thanks, KevinH |
11-20-2019, 01:32 PM | #23 |
Sigil Developer
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Please try removing the first wait call. Then try running terminate() first and if still running, then use kill. I would follow it for a wait of a few seconds max, not unlimited.
Does that help? KevinH Last edited by KevinH; 11-20-2019 at 01:37 PM. |
11-20-2019, 01:38 PM | #24 | |
Grand Sorcerer
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
11-20-2019, 01:39 PM | #25 |
Guru
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
Code:
m_process.terminate(); m_process.kill(); |
11-20-2019, 01:52 PM | #26 |
Grand Sorcerer
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I still say that the best way to deal with this is to simply close things how you know you're supposed to!
|
11-20-2019, 01:59 PM | #27 | |
Guru
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
Quote:
With a setting of 3 seconds, python was killed. I think this value is acceptable to everyone. Less seconds = crash. So instead of (-1) you can give (3000). A message (Error Parsing Result XML) appears, but at least it doesn't wait forever. |
|
11-20-2019, 02:28 PM | #28 |
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
|
11-20-2019, 02:41 PM | #29 |
Grand Sorcerer
Posts: 27,551
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
11-20-2019, 03:01 PM | #30 |
Sigil Developer
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Hi Becky,
Based on your testing, I just pushed the following to master: Code:
void PluginRunner::cancelPlugin() { // qDebug() << "in cancelPlugin()"; if (m_process.state() == QProcess::Running) { m_process.terminate(); } m_process.waitForFinished(2000); if (m_process.state() == QProcess::Running) { m_process.kill(); } m_process.waitForFinished(2000); ui.okButton->setEnabled(true); ui.progressBar->setRange(0,100); ui.progressBar->reset(); ui.textEdit->append(tr("Plugin cancelled")); ui.statusLbl->setText(tr("Status: cancelled")); ui.cancelButton->setEnabled(false); } Combined it waits for 4 seconds to be a bit safer. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Annotations (closed) | GRiker | Plugins | 68 | 06-17-2014 06:11 AM |
[GUI Plugin] Marvin XD (closed) | GRiker | Plugins | 141 | 06-15-2014 05:36 PM |
Plugin thread closed? | BookJunkieLI | Calibre | 3 | 10-05-2013 02:56 PM |
Epub crashes on Sigil for Mac, OK on Sigil for PC | crystamichelle | Sigil | 6 | 08-14-2013 02:52 PM |
Calibre crashes on menu Button selection | entity | Calibre | 6 | 12-15-2012 03:44 AM |