Commit Graph
100 Commits
Author SHA1 Message Date
James Turner dafd185595 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-26 08:54:18 +00:00
James Turner 3753c62783 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-18 14:49:33 +01:00
James Turner 3e804605b7 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-18 14:49:33 +01:00
James Turner 6ab7f68f4b 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-06 15:23:52 +01:00
James Turner b2e149a737 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-06 15:23:48 +01:00
James Turner 36dca92c2b HTTPRepo: Fix ownership of HTTPDirectory 2020-08-26 10:37:54 +01:00
James Turner 5a1ed52d7c Particles: rewrite global manager for thread-safety
Avoid re-registering the global node callback each time a new particle
animation is loaded, and use mutexes to protected all shared data.
2020-08-26 10:37:54 +01:00
James Turner fd191b51ce Avoid a race in MatModels loading
Add a mutex to ensure an SGMatModels only loads its models once. Caught
be ASan, hurrah.
2020-08-26 10:37:54 +01:00
James Turner 6167159795 API to reset the shared tree geometry 2020-08-26 10:37:54 +01:00
James Turner 672afdbc34 Fix for sprintf of nil numeric in Nasal
Spotted by valgrind, w00t. If you used a numerical formatter, such
as f,d or g, with. a nil value, we would read uninitialised data, and
generally get confused.
2020-08-26 10:37:54 +01:00
James Turner 27e61b3dec Ensure SGTerraSync::unbind drops all properties
Avoid some noise on reset, by dropping /all/ our SGPropertyNodes
2020-08-26 10:37:54 +01:00
James Turner 1b00ece8c4 SGBuildingBin: avoid read of un-inited memory
Where the building line is not as long as expected, ensure we read
valid memory.
2020-08-26 10:37:54 +01:00
James Turner d0f24229b2 HTTP: Use curl_multi_wait everywhere
Also check the result of the curl methods, in case they fail
2020-08-26 10:37:54 +01:00
James Turner 2fe60c9635 Terraysnc: fix incorrect handling of ‘entirely ocean’ tiles
We had some confusion between two error codes, meaning we would log an
error (and treat as a failure) a pure ocean 1x1 area, even though this
was entirely correct and expected behaviour.

Terrasync.cxx expected REPO_ERROR_NOT_FOUND, we need to convert the
file-level error to that, and avoid logging a warning.
2020-08-25 21:10:54 +01:00
James Turner 27a3ee3bce TerraSync: restart after max-errors is exceeded.
When we trip the max-error count for a session, back off for a period
of time and then retry (selecting a new TerraSync server).
2020-08-25 21:02:39 +01:00
James Turner 0721db3acd TerraSync: handle reinit better
Fix various cases where re-init could get things blocked. Remove the
duplicate storage of the active paths; now we always check the primary
data, and hence it can’t be out of sync.

Also remove the obsolete persistent cache code.

Fixes some of the issues discussed in:
https://sourceforge.net/p/flightgear/codetickets/2308/

Further improvements still to come, especially to retry on a better
schedule for intermittent connections.
2020-08-25 21:02:16 +01:00
James Turner fcd75cfae5 Logging: add log overload which copies filename
This is needed to fix a Valgrind error in the test-cases, due to logging
Nasal filenames which are GCed.
2020-08-04 11:58:05 +01:00
James Turner 6387a1d6d0 Fix compilation for some MSVC versions 2020-07-14 13:59:14 +01:00
James Turner 18d2bfcd8b HTTP: allow CAINFO to be set
Env var is SIMGEAR_TLS_CERT_PATH
2020-07-14 13:58:43 +01:00
James Turner 6738a3aa2b Helper to map string to log priority 2020-06-26 10:31:16 +01:00
James Turner 4faf0ea468 API to reset the resource manager, and remove
providers.

Needed to fix a bug with parsing -set.xml files in the launcher;
correctly loading XML needs the resource paths to be defined.
2020-06-26 10:30:47 +01:00
James Turner ca8dbb985e Fix zero-interval repeat on pick/knob animation
See:
https://sourceforge.net/p/flightgear/codetickets/2241/

Note did not adjust bug in knob-animation ignoring repeatable flag
(always marked repeatable) since this might break some aircraft.
2020-06-15 16:13:39 +01:00
James Turner 751cdc32a8 new version: 2020.2.1 2020-06-15 12:33:50 +01:00
James Turner 01ab3b2385 New SGGeodesy::advance, taking degrees 2020-05-30 16:27:42 +01:00
James Turner 11cf87951c SIMD flags: ensure we respect other compiler flags
Ensure we only ever extend the currently set compile flags when
ENABLE_SIMD is requested
2020-05-28 10:46:18 +01:00
James Turner 7c004a4c90 Fix compilation with Boost >= 1.73 2020-05-28 10:45:47 +01:00
James Turner a48693d273 Kill explicit setting of compiler flags in Debug
Use the CMake defaults for this.
2020-05-24 14:32:13 +01:00
James Turner 12d57a6373 Adjust RelWithDebInfo optimisation for Clang
This should give a bit of speed boost to macOS official builds.
2020-05-13 14:23:00 +01:00
James Turner c7c8fc7777 Better RelWithDebInfo flags for CL.exe 2020-05-08 14:31:44 +01:00
James Turner 6e054e57ef Windows: ensure RelWithDebInfo is fast
Default CMake RelWithDebInfo pessimizes inlining
2020-05-07 14:13:54 +01:00
James Turner 1d89a76d13 Old-style texture compression: better check
Make even more sure new-style texture-compression is active, before
deciding which old-style mode to use.
2020-05-07 11:47:25 +01:00
James Turner 65925cccdf Enable old-style texture compression
Thanks to Dany for tracking this down!
2020-05-05 20:40:29 +01:00
James Turner 898559ab31 Add copyPropertiesIf helper 2020-05-03 12:21:36 +01:00
James Turner ad3621e23b Add Canvas::Image.dirtyPixels() 2020-04-28 09:36:40 +01:00
James Turner 57b0f70a55 Nasal: improve message for non-object member access
Based on some discussion on this ticket:

https://sourceforge.net/p/flightgear/codetickets/2186/

Make this message slightly clearer.
2020-04-28 09:36:40 +01:00
James Turner bd93fb279b new version: 2020.2.0 2020-04-27 09:29:55 +01:00
James Turner 81bdae283a new version: 2020.1.1 2020-04-27 09:29:54 +01:00
James Turner 00e25404c7 Add simgear::optional
This is a poor-man’s proxy for std::optional until we have it.
2020-04-25 18:05:59 +01:00
James Turner 5c52cdc255 Fix for crash on reset:
https://sourceforge.net/p/flightgear/codetickets/2217/

Ensure that subsystem lookup during its own removal, returns nullptr.
Otherwise we cache an about-to-be dead pointer, which is Bad (TM)
2020-04-22 10:55:41 +01:00
James Turner 17d7808200 Remove a log message 2020-04-22 10:54:44 +01:00
James Turner f144bd5a89 CanvasImage: fix updating after fillRect / setPixel 2020-04-18 21:31:16 +01:00
James Turner b72553f6f0 Nasal: add isscalar() for Henning 2020-04-18 18:06:35 +01:00
James Turner c82a14c252 Nasal: fix build on non-C99 mode
It seems GCC at least is strict about C99 mode.
2020-04-16 16:44:20 +01:00
James Turner faa559e9af Nasal: add vecindex() built-in 2020-04-16 13:40:41 +01:00
James Turner c51c0c43ed Nasal: add more isTYPE helpers from Henning 2020-04-16 11:42:41 +01:00
James Turner 8626e0482d Nasal: add some type-check helpers.
These avoid building a string for the result, as typeof() does
2020-04-14 13:24:06 +01:00
James Turner c62c080a4b Logging: enable the WinDebug callback using an env var.
Instead of hard-coding, add an env-var SG_WINDEBUG to enable the
logging to the Windows debug stream.
2020-04-10 19:50:58 +01:00
James Turner c90ab3df5b Packages: consider checksum failures for retry.
This means an out-of-sync mirror causes a retry on a different
mirror server.
2020-04-10 15:03:17 +01:00
James Turner 21e21a1fa8 Allow TiedPropertyList to fire valueChanged 2020-04-10 10:41:00 +01:00
James Turner 92ebdbfacc Expose compare-version helper publicly.
This helper was added for Catalog version checking, but will be used in
FlightGear now, so move it to strutils.
2020-04-09 14:39:12 +01:00
James Turner 8dbabc8b43 Texture-compression fixes
Rename a highly confusing method, and disable the older texture-
compression code since it interacts badly with the new texture-cache.
2020-04-07 12:12:52 +01:00
James Turner c83dc79357 Revert to C++11 for now, found an alternative solution. 2020-04-06 10:44:23 +01:00
James Turner a53c1bfe8b CMake logic to export debug symbols 2020-04-05 14:04:19 +01:00
James Turner 6185b8fd0d Fix crash with Touch animation mouse-up 2020-04-05 14:04:19 +01:00
James Turner 9cdec99fa4 Quiet some warnings 2020-04-03 10:00:22 +01:00
James Turner e9e2053c64 Strutils: add hex-decoding helper
This will be used to allow entering hex bytes in XML files, for HID
descriptor support on Windows.
2020-03-31 10:09:47 +01:00
James Turner ec315bf26d Fix thumbnail cache retrieval
Use direct reading of thumbnail-cache files, instead of using libCurl
2020-03-26 16:51:00 +00:00
James Turner 74c304097d Fix for older libCurl versions 2020-03-26 16:51:00 +00:00
James Turner d65bb58317 HTTP: increase the Curl download buffer size
This improves download performance with large files, i.e,
most of them.
2020-03-24 20:34:49 +00:00
James Turner 8cf11f9208 Packages: fix handling of unsafe paths in zips
This was breaking the P-51D which contains a mis-named PNG file which
tripped the unsafe path detection.
2020-03-24 13:51:57 +00:00
James Turner 40725a76ab Packages: randomise mirror URL selection
Also add retry on mirrors when a download fails.
2020-03-21 18:31:53 +00:00
James Turner c8d802bc1d More SGPath / UTF-8 fixes
Use SGPath in more public APIs, so FlightGear doesn’t have to convert
and guess the conversion itself.
2020-03-15 14:26:42 +00:00
James Turner c3a169319c Fix UTF-8 shader path support
Work around osg::Shader::loadShaderFromSourceFile ’s lack of UTF-8
support by loading using our own istream, and then setting the text
directly.
2020-03-15 14:26:42 +00:00
James Turner 87da4680c7 Tweaks to Windows string conversion
Avoid use of code-cvt, and tolerate differences in compiler handling of
string literals (tested Clanged and MSVC, hopefully GCC is kind)
2020-03-14 20:10:20 +00:00
James Turner b258bc598e Load time-zones from UTF-8 paths correctly
Use _wfopen on Windows, after converting UTF-8 paths to wchar
2020-03-13 16:48:12 +00:00
James Turner f25c0c60a8 Use UTF8 paths in nearly all places, for OSG
We already request OSG to use UTF8 paths, so ensure whenever we pass
an SGPath to OSG, we use the correct conversion function.
2020-03-13 09:50:43 +00:00
James Turner f350bd31bd CanvasImage: fillRect / setPixel tweaks
Fix image dirtying and allocation without an underlying fike
2020-03-11 17:12:42 +00:00
James Turner 3e4d528859 Additional install / download failure test
Ensure we can install again on a previously failed URL.
2020-03-09 15:00:23 +00:00
James Turner d670cc13ac testHTTP mods to investigate macOS failure.
Disabled one test for now, since it’s blocking macOS release process
2020-02-25 16:12:12 +00:00
James Turner 43699d039f Track package install status persistently. 2020-02-25 14:27:48 +00:00
James Turner 9192b009e1 Catalog enable/disable feature 2020-02-24 11:35:04 +00:00
James Turner 0cf9dd165e Add NetBeans .gitignore 2019-12-24 20:58:48 +00:00
James Turner ec19dfc2f2 Fix Windows build
__PRETTY_FUNCTION__ is not portable, alas.
2019-12-18 23:43:40 +00:00
James Turner da45c26e7d Adding pixel manipulators to canvas::Image 2019-12-17 22:32:25 +00:00
James Turner c39a5fd8c0 Fix some Clang warnings 2019-12-17 22:32:25 +00:00
James Turner 0a7514c47b Add new ‘listener-safe’ SGProperty attribute
Used in FG to make certain tied properties as safe to use with
listeners, and hence suppress the warning.
2019-10-20 13:03:15 +01:00
James Turner 4b1a53367f Runway lights improvements from Sascha Reißner
(Sascha Reißner <reiszner@novaplan.at>)
2019-10-20 13:02:30 +01:00
James Turner ca97b4371b Use alternative name for internal expat_config.h
Avoid clashes when system has expat installed.
2019-10-05 17:19:09 +01:00
James Turner 93995cd742 Nasal GC : Fix crash running FG unit-tests
When freeing a context, clear its stack so that anything dangling in
them (especially the opStack) is GCed.
2019-09-19 08:05:55 +01:00
James Turner 114ddcff52 Tweak code for older GCC 2019-04-11 21:39:41 +01:00
James Turner 57339486d9 Flip the default meaning of alternate-mouse-wheel-dir 2019-04-11 20:37:47 +01:00
James Turner 5fdf6ef4f3 Simgear parts of queued command execution
Extend the command API to allow posting commands from arbitrary threads,
for deferred execution on the main thread. Additional pieces on the FG
side to follow shortly.
2019-03-24 14:13:42 +00:00
James Turner 7e969f4e28 Updated star rendering phases/parameters
As part of this, adjust the normalisation so the active cutoff value
corresponds to 0.0 normalised intensity.
2019-02-25 16:12:41 +00:00
James Turner 10a701308d Make star cutoff controllable at runtime.
When a new property /environment/star-magnitude-cutoff is defined,
use this to set an upper bound on the magnitude of stars displayed.
2019-02-25 16:12:41 +00:00
James Turner 6197098541 Guard against a potential race init-ing libCurl 2019-02-13 12:49:21 +00:00
James Turner 34b3c52a28 Improve HTTP redirect handling, and add test.
Ensure we get the final status code for the request after redirecting.
2019-02-13 12:34:17 +00:00
James Turner 95d065b3d7 Add strutils::iequals helper
Replaces another boost method
2019-02-06 12:35:08 +00:00
James Turner df6ec4f94c Property alias loop protection
Patch by Henning Stahlke
2019-01-22 17:24:21 +01:00
James Turner 61ebee12ad Set curl VERBOSE based on current SG log settings 2019-01-22 17:24:21 +01:00
James Turner fc2630e66d Revert "Logging API changes"
This is causing perf impact, so reverting until we figure out
a lower-impact solution.

This reverts commit 1be3e5771a.
2018-12-23 09:17:15 +00:00
James Turner 4b17ea95fc Random buildings: reduce log output in a common case 2018-12-20 16:10:36 +00:00
James Turner 1be3e5771a Logging API changes
Remove would_log() : callbacks receive all log messages so they can
do custom filtering individually.

Also move popup message handling into the private (d-ptr) of sglog(),
to keep the header as minimal impossible (no include of <vector>)
2018-12-20 16:10:36 +00:00
James Turner f05ff37560 Fix for assert with empty systems
Empty subsystem groups didn’t set their init state correctly, leading
to an assert on post-init. Fix this and add a test for it.

https://sourceforge.net/p/flightgear/codetickets/2043/
2018-10-23 15:29:56 +01:00
James Turner 0185884ca8 Catalogs: allow migration to alternate IDs 2018-10-16 09:56:56 +01:00
James Turner 46b271d75c Packages: improve localised string support 2018-10-12 10:49:14 +01:00
James Turner 854b958797 Packages: check for existing update when scheduling
This is fixing an issue identified in the launcher in a secondary way,
to ensure if another user of the API tries to schedule an already
scheduled package, we ignore the second request.
2018-10-05 10:40:35 +01:00
James Turner ff52b55a25 Mac: Set CMake OS-X deployment target correctly
Also raises the OS-X min version to 10.9 for libc++ compat
2018-10-01 22:28:56 +01:00
James Turner 05da3db2ed Fix a debug message left in the terrasync code 2018-09-24 14:54:20 +01:00
James Turner f4cad42958 Lat-lon parsing: catch exceptions from std::stod
The standard library throws exceptions in some cases, catch those
and return false. Extend the test coverage for some of the problematic
cases.
2018-09-13 23:47:24 +02:00
James Turner 32189b7239 Event-manager: add dump() method for debugging 2018-09-01 18:08:32 +01:00