Commit Graph

1989 Commits

Author SHA1 Message Date
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
87a6645875 Document version, build flags and patches for bundled pdfium.dll 2019-05-01 16:19:13 +00:00
c1c413a72d Windows: Update bundled pdfium to r3729 2019-05-01 16:19:13 +00:00
7ae8afffb1 OS X: Update bundled pdfium to r3729 2019-05-01 16:19:13 +00:00
eeb303a5c1 Avoid parsing non supported dates from comic vine 2019-04-28 09:30:15 +02:00
44db4397e8 Avoid parsing null values from comic vine 2019-04-28 09:28:50 +02:00
54a0610a06 Fix out of bounds crash 2019-04-28 09:28:15 +02:00
bc6b51ecf5 Add .editorconfig to prevent whitespace conflicts
Some IDE support this out of the box, others will need a plugin.
For more details see https://EditorConfig.org
2019-04-19 15:02:34 +00:00
14f1609ffa Merge pull request #43 from mytskine/fix-gcc8-warnings-develop
Fix gcc8 warnings
2019-04-19 16:56:56 +02:00
ad46d9089c Fix botched utf8 encoding. 2019-04-19 14:55:36 +00:00
88f668d663 bugfix: 'switch case' for OpenVG had no 'break' 2019-04-03 20:44:57 +00:00
35bb3b553f bug: 'else' without braces but several lines indented (#41)
* bug: 'else' without braces but several lines indented

* always set previousIndex in Render::updateBuffer()

As discussed in #41, the previous index was meant to be
updated in every case, but the faulty indentation
suggested another behavior.
2019-04-03 20:43:27 +00:00
8c8521a8dc Library: reorder initialization of ResponseParser 2019-04-01 11:25:16 +02:00
ebcb52bf16 Library: bugfix a 'switch case' that had no 'break' 2019-04-01 11:25:16 +02:00
0453bf126a Library: unused method parameter, so comment out the name 2019-04-01 11:25:16 +02:00
9aff260f06 Library: unused method parameter, so comment out the name 2019-04-01 11:25:16 +02:00
6467e2a510 Library: unused method parameter, so comment out the name 2019-04-01 11:25:16 +02:00
3657745f8b Library: reorder initialization of YACReaderHttpSession 2019-04-01 11:25:16 +02:00
8fa62c3a20 Library: unused method parameter, so comment out the name 2019-04-01 11:25:16 +02:00
7cb57d886a Library: fix misleading indentation 2019-04-01 11:25:16 +02:00
f351e41fa0 Library: add missing 'case' to a 'switch' 2019-04-01 11:25:16 +02:00
11c99efa30 Library: explicit braces to avoid ambiguous 'else' (hidden in macro) 2019-04-01 11:25:16 +02:00
62db328ab5 Library: explicit braces to avoid ambiguous 'else' 2019-04-01 11:25:16 +02:00
20bcd2235a Library: explicit braces to avoid ambiguous 'else' 2019-04-01 11:25:16 +02:00
6f9d03847a Library: typecast in comparison of int and long u int 2019-04-01 11:25:16 +02:00
5927b1be45 Library: remove unused variables (shadowed by object attributes) 2019-04-01 11:25:16 +02:00
6093e003e9 Library: add missing 'default' to non-exhaustive 'switch' 2019-04-01 11:25:16 +02:00
b77eaf6d9c Library: reorder initialization of FolderModel 2019-04-01 11:25:16 +02:00
9c3720ceb9 Library: fix misleading indentation 2019-04-01 11:25:16 +02:00
fb97cfa1dc Library: explicit {} on ambiguous 'if if else' 2019-04-01 11:25:16 +02:00
2189e19a91 Library: fix misleading indentation 2019-04-01 11:25:16 +02:00
3babc0980e Library: remove unused variable 2019-04-01 11:25:16 +02:00
66941510f0 Library: fix misleading indentation 2019-04-01 11:25:16 +02:00
2274e49ed0 Library: fix misleading indentation 2019-04-01 11:25:16 +02:00
c044e93446 Library: typecast in comparison of int and quint64 2019-04-01 11:25:16 +02:00
f7b4b7a5d1 Library: add missing 'case' to a 'switch' 2019-04-01 11:25:16 +02:00
3062d8826e Library: reorder initialization of LibraryWindow 2019-04-01 11:25:16 +02:00
4ac3407106 type qualifiers are ignored on function return type 2019-04-01 11:25:16 +02:00
b2f44a939e fix misleading indentation of YACReaderFlowGL::remove 2019-04-01 11:25:16 +02:00
f87e113f89 fix misleading indentation of YACReaderFlowGL::setCurrentIndex 2019-04-01 11:25:16 +02:00
472e9f9832 reorder initialization of YACReaderFlowGL 2019-04-01 11:25:16 +02:00
9ace47ccc0 explicit parenthesis in complex comparison 2019-04-01 11:23:33 +02:00
5ad0e293ac typecast comparison from unsigned to int 2019-04-01 11:23:33 +02:00
8879e7abc5 Initialize parent class 2019-04-01 11:23:33 +02:00
4f7f760960 fix misleading indentation of ComicDB::toTXT 2019-04-01 11:23:33 +02:00
7b9502bd97 fix misleading indentation of PictureFlow::showSlide 2019-04-01 11:23:33 +02:00
fae244b4e3 typecast comparison in PictureFlow::showSlide 2019-04-01 11:23:33 +02:00
e084bdd447 cases missing in 'switch' in PictureFlow 2019-04-01 11:23:33 +02:00
0c02564fc5 cases missing in 'switch' in PictureFlow 2019-04-01 11:23:33 +02:00
f012a6d30e reorder initialization of PictureFlowState 2019-04-01 11:23:33 +02:00