Commit Graph

52 Commits

Author SHA1 Message Date
Guillaume Munch
0a8b7f6a57 Perf comments: getFormatFromFile slows LyX startup considerably
It is currently called on hundreds of files: settings, layouts, icons, cached
graphics files (incl. graphics from files that are not opened on startup).

According to callgrind, fixing the FIXME comments could speed up startup by more
than 30%.
2016-07-31 18:34:33 +01:00
Guillaume Munch
2fd2e65745 C++11 supports thread-safe initialization of statics
A static local variable is guaranteed to be initialized only once, and in time.

Lambda expressions can be used to perform complex initialization of those static
variables on the spot.

(starting from: gcc >= 4.8, msvc >= 2015)
2016-07-31 18:34:33 +01:00
Jean-Marc
0fbc402141 Fix unitialized members in CacheItem
Fixes coverity issue 23380.
2015-03-04 22:50:37 +01:00
Georg Baum
b88f6ea3aa Mark some singletons with FIXME THREAD 2014-07-05 15:20:54 +02:00
Richard Heck
065db68067 Fix a bunch of minor issues discovered by the cppcheck script. 2014-04-21 11:52:00 -04:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Georg Baum
cb5dd33475 Split pdf format as discussed on the list
Previously, the format used for included pdf files was the same as for
document export via ps2pdf. This caused unwanted conversion routes, e.g.
export via odt->pdf instead of dvi->ps->pdf.
I renamed the format for included graphics and not for exported documents,
since otherwise the command line syntax for export would change. This would
require more adaptions for the users, since with the chosen solution the
custom converters are almost always changed correctly in prefs2prefs(),
so that only custom external templates need manual adjustement.
2013-03-21 20:13:02 +01:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Pavel Sanda
72a6c77a51 support:
frontends:
onlyFilename -> onlyFileName

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34240 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:28 +00:00
Pavel Sanda
62ca7f3ae5 Proper camel case for FileName.absFilename
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34234 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:09 +00:00
Vincent van Ravesteijn
13633b346e Prevent the ghost index files when the converter cache is either not used or not initialized.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33868 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-25 18:03:49 +00:00
Pavel Sanda
4179ca47b3 At least we have agreed upon this
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31022 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-13 21:54:32 +00:00
Vincent van Ravesteijn
c0ac23512e Cosmetics and constify.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30309 a592a061-630c-0410-9148-cb99ea01b6c8
2009-06-29 23:43:23 +00:00
Vincent van Ravesteijn
a52cac0476 Fix part 2 of bug #5758: Crash when closing the dosbox from which LyX was started.
A problem occurs when we write the ConverterCache index file. This action is instantiated in the destructor of the 'static ConverterCache' object. The use of QFileInfo at that point leads to a crash.

It is maybe not a good idea at all to put part of the functionality in a destructor, especially not when we do not delete the object ourselves and when this functionality uses external libraries etc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29602 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-10 00:03:14 +00:00
Richard Heck
b90919e48b Revert r26683 and add some comments making it a little clearer what
is going on here.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26814 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-08 15:07:09 +00:00
Richard Heck
4dc976497f Simplify the mover semantics a bit further: The extra variable being passed in
the deleted functions was never actually used, and it hasn't been for a very
long time. So the comment about the "other version" of Mover::copy() was way
out of date.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26683 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-02 14:41:07 +00:00
Jean-Marc Lasgouttes
9b4a26a252 rename assert.h to lassert.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24559 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-30 08:26:40 +00:00
André Pönitz
7f461f4392 infrastructure for 'graceful asserts'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24216 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-10 21:49:34 +00:00
André Pönitz
11a0458d3f next try...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24100 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-02 23:06:22 +00:00
André Pönitz
2012beb58e revert last patch. there's something wrong, possibly unrelated to this
patch, but as this was rather largish...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24099 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-02 22:44:33 +00:00
André Pönitz
7677e9487c simplify Lexer use a bit
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24098 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-02 22:14:45 +00:00
Abdelrazak Younes
e7bb71ff4e header cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22178 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-16 22:09:28 +00:00
Abdelrazak Younes
e01219bb0c Fix wrong test introduced in rev 22150
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22154 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-14 22:35:23 +00:00
Abdelrazak Younes
15c9510db4 Use FileName::createDirectory() instead of support::mkdir().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22150 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-14 18:36:01 +00:00
Abdelrazak Younes
2e34b2876a get rid of lyxlib.h:chmod.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22126 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 11:24:10 +00:00
Abdelrazak Younes
4752cc8d61 compile fix following undo/redo mixup. Sorry again!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22125 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 10:59:31 +00:00
Abdelrazak Younes
4e364577e3 Introduce FileName::changePermission() and fix ConverterCache.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22123 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 10:38:31 +00:00
Abdelrazak Younes
c87b197cd8 Fix copy&paste error round 2.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22121 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 09:02:58 +00:00
Abdelrazak Younes
456bc6a829 Fix copy&paste error.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22120 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 09:01:35 +00:00
Abdelrazak Younes
0186514631 Simplify Movers API and port to FileName.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22119 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-13 08:20:45 +00:00
Abdelrazak Younes
7c392af6ea getting rid of superfluous lyx::support:: statements.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22106 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 19:57:42 +00:00
Abdelrazak Younes
9abb7db468 getting rid of superfluous std:: statements.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22104 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 19:28:07 +00:00
Abdelrazak Younes
b89cc942eb 'using namespace lyx::support' instead of 'using support::xxx'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22103 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 18:57:56 +00:00
Abdelrazak Younes
9383f4c3c6 'using namespace std' instead of 'using std::xxx'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22097 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 10:16:00 +00:00
Abdelrazak Younes
377ae30bd8 lyxlib.h:sum -> FileName::checksum()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21874 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-30 09:23:44 +00:00
André Pönitz
2506e0d643 assimilate BOOST_CURRENT_FUNCTION
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21867 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-29 21:10:35 +00:00
Abdelrazak Younes
b1546aa703 MSVC compile fix.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21858 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-29 09:00:28 +00:00
André Pönitz
9d0ea8aeff Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
Now support/* should have no dependencies on src/* anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21851 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-29 07:04:28 +00:00
Abdelrazak Younes
f07105d0e5 * FileName:
- removeFile(): replace unlink
- copyTo(): add 'overwrite' parameter.

* getcwd.cpp: simplify.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21843 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-28 09:01:49 +00:00
André Pönitz
e1ce2f92db reduce line noise
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21631 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-15 20:04:51 +00:00
Abdelrazak Younes
c1c5e5b50e compile fix.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21510 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-07 23:39:12 +00:00
André Pönitz
319f70b839 use support::FileName
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21500 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-07 22:04:02 +00:00
André Pönitz
a1eb7cac0e more of it
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21496 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-07 21:25:22 +00:00
André Pönitz
0e08bc5e16 start using FileName::exists()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21044 a592a061-630c-0410-9148-cb99ea01b6c8
2007-10-18 19:29:32 +00:00
Lars Gullik Bjønnes
26f336769a Remove warnings reported with gcc 4.3:
- Modifier on return type ignored
	- Ambigous else
	- Ambigous logical operators
	- Semi-colon instead of empty block
	- Missing header files
	- Missing using std::XX
	- Initialization out of order


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20304 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-16 10:36:57 +00:00
Jürgen Spitzmüller
c1bbe62b53 fix bug 3819 (patch from Georg Baum):
* src/ConverterCache:
	- fix handling of movers
	- handle pstex/pdftex files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19023 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-10 09:13:21 +00:00
Lars Gullik Bjønnes
897436efbb Whitespace cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18550 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-28 22:27:45 +00:00
Georg Baum
89b5802463 Fix files with spaces in converter cache;
Delete cached conversions if the converter changes.

	* src/frontends/qt4/QPrefs.cpp
	(PrefConverters::update_converter): delete cached files since the
	new converter might create different ones
	(PrefConverters::remove_converter): ditto

	* src/support/convert.cpp
	(unsigned long convert<unsigned long>): New template specialization

	* src/ConverterCache.h
	(ConverterCache::remove_all): New method, removes all cached
	conversions of a particular converter

	* src/ConverterCache.cpp
	(CacheType): Also store source file format
	(ConverterCache::Impl::readIndex): Handle files with spaces correctly
	(ConverterCache::Impl::writeIndex): ditto
	(various): adapt to changed CacheType


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18378 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-17 08:31:00 +00:00
Georg Baum
9c765e64de * src/ConverterCache.cpp
(ConverterCache::Impl::readIndex): prevent assertion in
	fs::last_write_time for corrupted cache index


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18341 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-15 11:34:26 +00:00