Go to file
Igor Kushnir bb964c8566 Reader: eliminate SlideInitializer class
GoToFlow shared its YACReaderFlow flow object with SlideInitializer
objects it created. GoToFlow modified the flow object in the main thread
and SlideInitializer modified the flow object in its own thread without
any thread synchronization. The only reason this usually worked was the
timing: SlideInitializer finished its work before the next time GoToFlow
heavily accessed the flow object. This was a data race and thus
undefined behavior.

Additionally, this commit eliminates a memory leak:
a new SlideInitializer object was constructed each time a comic was
opened in YACReader. These objects were never destroyed.

SlideInitializer called PictureFlow::triggerRender() from its own
thread. This function restarted triggerTimer, which QTimer's API forbids
doing from another thread. This commit eliminates the following errors
from YACReader's standard output:
    QObject::killTimer: Timers cannot be stopped from another thread
    QObject::startTimer: Timers cannot be started from another thread

Without this fix YACReader on GNU/Linux often uses an entire CPU core
from launch till exit if hardware acceleration is disabled (#56).

The data race could alternatively be fixed by adding thread
synchronization code into most GoToFlow member functions. But the code
in SlideInitializer::run() is executed only once per opened comic; it is
not slow enough to justify creating a dedicated thread and suffer the
overhead of thread synchronization while the comic is being read.
I have tested several 550 pages long 1 GB comic books.
SlideInitializer::run() took up to 25 milliseconds in the worst case,
but usually 2-4 times less. For smaller 30-page comics it usually takes
less than a millisecond.

Even though mutexGoToFlow was locked in SlideInitializer::run(), there
is no need to lock it in the code moved to GoToFlow::setNumSlides():
this function is called in the main thread like all the other GoToFlow's
member functions that access the flow object. PageLoader does not have
access to the flow object.
2019-05-29 10:56:43 +03:00
common Merge pull request #43 from mytskine/fix-gcc8-warnings-develop 2019-04-19 16:56:56 +02:00
compressed_archive Use unicode for 7zip in the unix version. 2019-02-18 17:00:31 +01:00
custom_widgets type qualifiers are ignored on function return type 2019-04-01 11:25:16 +02:00
dependencies Document version, build flags and patches for bundled pdfium.dll 2019-05-01 16:19:13 +00:00
files Normalize line endings 2018-08-07 11:09:02 +02:00
images Merge - 9.0.0 release 2018-02-18 10:35:24 +01:00
QsLog Add .gitattributes rules for text and binary handling 2018-07-30 15:04:04 +02:00
release Normalize line endings 2018-08-07 11:09:02 +02:00
shortcuts_management Normalize line endings 2018-08-07 11:09:02 +02:00
tests/compressed_archive_test Normalize line endings 2018-08-07 11:09:02 +02:00
YACReader Reader: eliminate SlideInitializer class 2019-05-29 10:56:43 +03:00
YACReaderLibrary Avoid parsing non supported dates from comic vine 2019-04-28 09:30:15 +02:00
YACReaderLibraryServer Stop QtWebApp from eating out debug messages 2018-08-04 12:31:34 +02:00
.editorconfig Add .editorconfig to prevent whitespace conflicts 2019-04-19 15:02:34 +00:00
.gitattributes Update .gitattributes to cover all text files 2018-08-07 11:02:26 +02:00
.gitignore Ignore libp7zip folder and pch files. 2019-02-18 17:00:30 +01:00
.travis.yml Set up continuous integration 2019-02-22 19:34:36 +01:00
appveyor.yml Set up continuous integration 2019-02-22 19:34:36 +01:00
background.png Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
CHANGELOG.md Fix botched utf8 encoding. 2019-04-19 14:55:36 +00:00
cleanOSX.sh Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
compileOSX.sh Update compilation scripts in macos. 2019-02-18 17:00:30 +01:00
config.pri Update compressed_archive to support the latest version of 7zip 18.05 2019-02-18 17:00:30 +01:00
COPYING.txt Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
icon.icns Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
INSTALL.md Add .gitattributes rules for text and binary handling 2018-07-30 15:04:04 +02:00
mktarball.sh Update mktarball.sh for git usage (needs .gitattributes). 2018-06-06 13:46:24 +02:00
README.txt Fix botched utf8 encoding. 2019-04-19 14:55:36 +00:00
releaseOSX.sh Update compilation scripts in macos. 2019-02-18 17:00:30 +01:00
YACReader.1 Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReader.desktop Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReader.pro Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReader.svg Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.1 Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.desktop Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00
YACReaderLibrary.svg Headless server: simplify system config logger 2018-01-28 13:32:56 +01:00

LICENSE
*******
This software has been developed by Luis Ángel San Martín Rodríguez (luisangelsm@gmail.com) under GPL v3 license 
(for more details read COPYING.txt).

CONTACT
*******
Project home page : www.yacreader.com
e-mail:
   info@yacreader.com
   support@yacreader.com
Social:
   Facebook - http://www.facebook.com/YACReader
   Twitter  - https://twitter.com/yacreader
   YouTube  - https://www.youtube.com/user/yacreader

If you need help or have any suggestion, please, send me an e-mail.
   
DONATIONS
*********   
YACReader is free but it needs money to still be alive, so please, 
if you like YACReader, visit the home page and make a donation.