Various improvements/fixes in GeneratorThread::run()
Needs ReviewPublic

Authored by kmorwinski on Mar 3 2018, 10:47 PM.

Details

Reviewers
asturmlechner
Summary
  1. [FIX] crash when opening a document and no backend was found The function GeneratorThread::run() accesses backend pointer without checking their validity. If the application fails to find any backend, these pointers will be nullptr and the application will crash.

    GeneratorThread::run() is called once a new file is opened, e.g. if you call $cirkuit /path/to/file on the commandline.
  1. also show error msg when generating preview failed because of missing backends
  1. Only re-select the backend, if this is really wanted. Calling Backend::autoChooseBackend(file) is pretty costly. For each backend, the whole file will be searched for various keywords. The number of hits is then compared.

    Therefore the constant boolean value CirkuitSettings::autoSelectBackend() will be checked first. Only if re-selecting is enabled by the user, the backend selection will be done.

    This could reduce some otherwise unnecessarily wasted cpu cycles.

Diff Detail

Repository
R657 Cirkuit
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
kmorwinski requested review of this revision.Mar 3 2018, 10:47 PM
kmorwinski created this revision.
kmorwinski edited the summary of this revision. (Show Details)Mar 3 2018, 10:50 PM
kmorwinski edited the summary of this revision. (Show Details)
kmorwinski edited the summary of this revision. (Show Details)Mar 3 2018, 10:53 PM
kmorwinski edited the summary of this revision. (Show Details)
kmorwinski added a reviewer: asturmlechner.
asturmlechner added inline comments.Apr 1 2018, 8:52 PM
src/generatorthread.cpp
57

Thanks, I see this is based on master branch - but I have no way to build this anymore for lack of Qt4. Could you instead base it on frameworks?

This line is the only difference.