Commit Graph

5629 Commits

Author SHA1 Message Date
Julian Smith
2a74cc9e5f Added logdelta system to allow control of log priorities based on source filename, line and function name.
See simgear/debug/logdelta.hxx for usage.
2020-10-31 23:58:57 +00:00
Julian Smith
365e5265c8 simgear/nasal/cppbind/test/cppbind_test_ghost.cxx: workaround for OpenBSD.
OpenBSD's clang++ can't cope with this code, so we disable it.
2020-10-31 23:52:23 +00:00
Julian Smith
cc699871a3 simgear/scene/model/SGReaderWriterXML.cxx: minor change to addTooltipAnimations().
Improved calculation of num_new_animations.
2020-10-31 23:52:23 +00:00
Julian Smith
510b25f8b8 Allow use of old zlib-1.2.3 on OpenBSD.
As of 2020-08-01, OpenBSD's system zlib is 1.2.3 which doesn't
have gzoffset(). However we can get away with this by making
gzfilebuf::approxOffset() always return zero.
2020-10-31 23:52:23 +00:00
James Turner
99bd9bb4c0 Terrasync: tarball extraction, use larger buffer
Use a 1MB buffer, 2kByte is very 1979 :)
2020-10-30 22:50:44 +00:00
James Turner
8d6d671cc1 TerraSync: switch to per-directory hash caching
Avoid a central hash cache becoming enormous, now we use the selective
download scheme for the tile dirs.

Hash name is changed to co-exist with older versions.
2020-10-30 22:49:53 +00:00
James Turner
990c53fc9c Fix Airports/ initial sync 2020-10-30 19:23:00 +00:00
James Turner
0dd046065d TerraSync: avoid 404s to probe missing tiles
Use the top-level dirIndex files to determine if a 1x1 tile dir
exists, instead of proving the server via a 404. This reduces the
number of requests we make considerably, which is … important.
2020-10-30 16:45:45 +00:00
James Turner
1ab1cae199 TerraSync: validate local dirs incrementally
Add a process() method to HTTPRepository, and use this to
incrementally validate subdirs after the .dirIndex is received. This 
avoids large pauses of the TerraSync thread, when all of Airports/
is validated at once.
2020-10-30 11:51:26 +00:00
James Turner
87558f8dde TerraSync: use an unordered_map for the hash cache
Linear-scan is a bit slow in debug builds, for the large Airports/ tree;
switch to an unordered_map.

Will back-port to the LTS once tested a bit more.
2020-10-29 23:13:10 +00:00
James Turner
e04249ba48 Props: allow flushing the atomic change listener
Trying to narrow down causes of the ‘unregister listeners crashes on
shutdown’ reports.
2020-10-29 17:26:38 +00:00
Automatic Release Builder
afcbf2ff3a Catalog migration: migrate packages too
When doing a catalog migration to a new ID (eg, 2018 -> 2020), also
mark the installed packages for installation, on the new catalog.

Related to this, when manually removing a catalog, record this fact,
so we don’t re-add it automatically due to migration.

Add unit-tests covering both of these cases.
2020-10-29 14:09:36 +00:00
Automatic Release Builder
d395a5c495 Sound: readWAV: avoid common exceptions.
Avoid exceptions for the common ‘file not found’ case, and instead
return false / nullptr. Erik says it’s fine.
2020-10-29 14:09:29 +00:00
Automatic Release Builder
29d4899f1f TerraSync: retry after socket failures
Assume socket failures are intermittent, up to some maximum count
(currently configured as 16). Add a test case to cover this.
2020-10-29 14:08:47 +00:00
Automatic Release Builder
baf95da93a TerraSync: Rate-limit hash-cache writes
This helps with IO-limited performance on Windows
2020-10-29 14:07:04 +00:00
Automatic Release Builder
dd6dfafabf SGPath: optimise exists() on Windows
For a very common existence only check, use a dedicated win32 API
function, to save some time.
2020-10-29 14:06:26 +00:00
Automatic Release Builder
439fa4c4a1 TerraSync: fix Windows behaviour
SGDir on Windows returns dot-files by default, which includes our
hash-cache, causing it to be orphaned.
2020-10-29 14:02:58 +00:00
Automatic Release Builder
b7308fa3ad Add a hasInstance to ResourceManager
This is needed to allow order-independent shutdown, due to the dumb
ownership behaviour for providers.
2020-10-29 14:02:50 +00:00
Automatic Release Builder
fba00d6894 SGFile::computeHash: check malloc result
Trying to fix a reported crash, in this code. malloc() returning null
seems unlikely but worth checking for. ALso use a unique_ptr with
a custom deleter to avoid a leak if we throw.

Sentry-Id: FLIGHTGEAR-3Y
2020-10-29 14:02:36 +00:00
Automatic Release Builder
77786e8e9b XMLSound: Avoid using exceptions for missing file
Reducing how noisy our exception reporting is, by using simple return
value from SGXMLSound::init.
2020-10-29 14:02:30 +00:00
Automatic Release Builder
a5dd5cdc80 TerraSync: fast start Airports/ sync
If TerraSync/Airports is missing, download Airport_archive.tgz instead.
In all other cases update as normal. This has the effect, that fresh
installs make many fewer requests to TerraSync servers.
2020-10-29 14:01:52 +00:00
Automatic Release Builder
ed357c5c8f Terrasync: re-add persistent update cache
Re-add (with some tweaks) the persistent tile-cache code, so that
TerraSync checks the server at most once per 24 hour period, for a
given repository path.

(Disbale the cache by setting /sim/terrasync/enable-persistent-cache=0)
2020-10-29 14:00:55 +00:00
Automatic Release Builder
6d892e8d18 Packages: fix circular refernece bug
Packages had a strong back-pointer to their catalog, creating a circular
reference loop. Break this so catalogs & packages are freed on exit.
2020-10-29 14:00:47 +00:00
Automatic Release Builder
ed8ff68114 Catalogs: fix enabling/disabling
Relates to bug Michael found in the launcher:
https://sourceforge.net/p/flightgear/codetickets/2380/
2020-10-29 14:00:40 +00:00
Automatic Release Builder
c0323e34a5 TerraSync: tweak warnings around checksum failures
Trying to reduce log spam when there is a server-side failure.
2020-10-29 14:00:22 +00:00
Automatic Release Builder
1ebb0787ad Fix level of terrasync start/stop messages 2020-10-29 14:00:12 +00:00
Automatic Release Builder
5e37c2092a Harden Repo::computeHashForPath
Check for some error cases in computeHashForPath, since this showed up
in some crash reports.
2020-10-29 14:00:01 +00:00
Automatic Release Builder
b3fc8deb5c Exceptions: optional callback for exception throws.
This is to allow recording an error+stacktrace whenever an exception
is thrown, since that’s the point when the stack is interesting.
2020-10-29 13:59:44 +00:00
James Turner
f489232cdb Fix for crash reported by Michael Danilov
In case uDNS returns a NULL txt pointer, don’t try to create a
std::string from it, since this will crash,

See: https://sourceforge.net/p/flightgear/codetickets/2398/
2020-10-25 18:59:37 +00:00
Scott Giese
f393a246ac METAR: When Wind unit not specified, default to knots.
FLIGHTGEAR-F6 resolved
2020-10-23 23:26:28 -05:00
Scott Giese
d7a149e8cd METAR Wind Sensor Failure.
FLIGHTGEAR-F9 resolved.
2020-10-23 22:12:51 -05:00
Erik Hofman
4a660e3827 callers already compensate for year-from-1900 and mont-start-from-0 2020-10-22 10:45:06 +02:00
Erik Hofman
ce187e614a Fix the way struct tm works, year is since 1900 (so fix a year-2000 problem...) and month is 0-11 instead of 1-12. Return a string we constructed ourselves to prevent a possible buffer overrflow. Luckily the function isn't used in active code. 2020-10-22 10:20:37 +02:00
James Turner
83500dd413 CMake: use same 3rdParty logic as FlightGear
Avoids need to specify the 3rd-party dir, in the standard/fgmeta
layout of source directories, and accept more combinations of path,
when the user specifies a value.
2020-10-20 16:51:20 +01:00
Automatic Release Builder
2ad6e351ac Update version file 2020-10-13 22:28:42 +01:00
Bertrand Coconnier
8c51d30ddb Make CMake stop complaining about target "Udns::Udns" not found when rebuilding SimGear. 2020-10-03 17:58:11 +02:00
James Turner
670460a079 Set GCC RelwtihDebInfo opt flags 2020-09-29 17:40:25 +01:00
Scott Giese
cb4f3b1ca9 REVIEW: Memory Leaks 2020-09-24 22:24:12 -05:00
James Turner
4560095c36 Change props.cxx to throw std::exception
Throwing std::string is slightly unconventional, switch to throwing
exceptions inheriting std::exception.
2020-09-10 11:25:15 +01:00
Stuart Buchanan
b279384aef Check correctly for failed BUILDING_LIST
Previous additional checks for a value BUILDING_LIST entry
used an enum incorrectly, resulting in all BUILDING_LIST entries
failing.  Now fixed to check bad() / fail() which are bool.
2020-09-09 21:44:20 +01:00
Erik Hofman
01a190fea8 Fix a bug in the rotation_matrix function 2020-09-09 15:50:25 +02:00
James Turner
1341d1e1f2 Missed fix for logging in the test-suite 2020-09-08 12:34:37 +01:00
James Turner
051c920a99 Fix Linux compilation
Missing <cstring> header for strdup.
2020-09-08 08:15:41 +01:00
James Turner
0efcc14e91 Add MANDATORY_INFO log priority.
New log-level to avoid using ‘ALERT’ for expected mandatory messages,
since I want to do error collection on real alerts in a future commit.

As part of this, split logstream.hxx into separate header files, and
add a new virtual hook to LogCallback which takes the complete log-entry
2020-09-07 14:44:29 +01:00
James Turner
c7f013e7e5 Don’t wipe startup message on pausing logging. 2020-09-07 14:42:16 +01:00
James Turner
19ace8f0f9 Silence an alert message 2020-09-06 14:48:17 +01:00
James Turner
908496d43d ASan: make copied files in log entries safe at init.
Ensure that if we copy file-names of log entries while startup
logging is active, we free them, but only once startup logging is
disabled, or on shutdown. This is needed to avoid crashes when
we use file-name copying for the Qt message handler.
2020-09-05 10:43:01 +01:00
James Turner
52c0f04e6e Bindings: don’t cache the command pointer
Caching it complicates add/remove command logic, so making a simple
fix for now, which can be back-ported to 2020.2; ideally we would
cache the pointer but have an invalidation scheme, but that’s
considerably more work and risk.

Relates to Sentry crash:
https://sentry.io/organizations/flightgear/issues/1858764364
2020-09-04 10:51:32 +01:00
James Turner
f6656354b8 Refactor SGBuildingBin
Trying to trace a crash that was reported, but along the way fix a leak
of BuildingBins. Also avoid allocating some std::strings on the heap.
2020-09-03 20:35:50 +01:00
Erik Hofman
4928509646 Mipmapping requires a power-of-two destination buffer even if the source isn't. Neglecting this causes a massive bufferoverflow of the destination buffer. So for now we do not mipmap non-power-of-two textures and throw a warning. This affects at least the PC-9M and F-16, presumable many others. The effect will be a black texture when zoomed out and the proper texture when zooming in close enough. 2020-08-29 14:45:47 +02:00