Commit Graph

18 Commits

Author SHA1 Message Date
Luis Ángel San Martín
686e91af57 Fix missing include 2023-04-30 14:28:40 +02:00
Luis Ángel San Martín
6593f03740 Remove some unused includes 2023-04-30 14:07:35 +02:00
Joan Karadimov
6aeed9ae90 Include some missing headers 2021-11-02 11:02:32 +01:00
Luis Ángel San Martín
ae43f23c85 Use angleDelta
pixelDelta is only provided in systems that support it
2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
740eab5025 Update QWheelEvent delta usage 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
1c144d950d Use fully qualified names 2021-10-19 00:00:08 +02:00
Luis Ángel San Martín
5aa02a19bb clang-format 2021-10-18 21:56:52 +02:00
Felix Kauselmann
5dbbaad73b GoTo flows: Untangle and refactor goTo signal to new syntax 2021-06-29 13:53:12 +02:00
Felix Kauselmann
8377de7c3e Clazy: Use fixits to refactor some old style signal connections 2021-06-29 13:53:12 +02:00
Igor Kushnir
6efc31682c Reader: eliminate duplicate calls to GoToFlow::preload()
GoToFlow::setNumSlides() is called each time a comic is opened. So when
e.g. three comics were opened one after another without restarting
YACReader, each of the PictureFlow::centerIndexChanged* signals was
connected to GoToFlow::preload three times, which multiplied the number
of calls to preload() accordingly.

During my testing PictureFlow::centerIndexChanged* signals were never
emitted before the first call to GoToFlow::setNumSlides(), so connecting
in GoToFlow::GoToFlow() should not cause extra calls to preload().
2019-09-18 18:12:03 +02:00
Igor Kushnir
28b8fca729 Reader: make PageLoader::working atomic to fix a data race
This data member is modified in PageLoader's own thread and accessed
without locking from an external thread in the public busy() function.

Reorder setting working and img in PageLoader::run() to avoid a data
race in PageLoader::result() called from GoToFlow::updateImageData().
2019-09-18 18:12:03 +02:00
Luis Ángel San Martín
e3ec56aa43 Format code using clang-format 2019-05-30 19:46:37 +02:00
Luis Ángel San Martín
d1b1965fc0
Merge pull request #59 from vedgy/eliminate-SlideInitializer
Reader: eliminate SlideInitializer class
2019-05-30 18:29:02 +02:00
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
Igor Kushnir
12aabf7960 Reader: fix thread safety bugs in PageLoader 2019-05-24 14:53:59 +03:00
Felix Kauselmann
d5a11fb16b Add .gitattributes rules for text and binary handling 2018-07-30 15:04:04 +02:00
Luis Ángel San Martín
2a136e3ea3 Merge - 9.0.0 release 2018-02-18 10:35:24 +01:00
apollo2k4
f2a356fc70 Update russian translation. Need to subtract and to bring the terminology to a common denominator 2018-01-08 16:32:56 +00:00