21802 Commits

Author SHA1 Message Date
Sam Edwards
1c6ae84cdc dtoolutil: Remove HAVE_OPEN_MASK
Rationale:
1. Per standard, fstream::open takes 2 arguments.
   If platforms add a third, they're out of spec.
2. The only platform I could find that takes a file
   mask specifically as the third argument is IRIX,
   which Panda hasn't targeted in forever.
3. The mask being requested isn't even particularly
   interesting - falling back to a platform default
   is best.
4. When USE_PANDAFILESTREAM is defined, pfstream
   is implemented as PandaFileStream, which doesn't
   have a three-argument open() and breaks immediately.
5. makepanda doesn't ever define HAVE_OPEN_MASK
6. It's been broken for so long that, if it were
   important to anybody, it would have been fixed by now.
2018-05-30 12:04:06 -06:00
Sam Edwards
00e259d4dd dtoolbase: Fixup NODEFAULT macro
1. Test for Clang before _MSC_VER (Clang defines this on Windows)
2. Use it in pdtoa.cxx
2018-05-30 11:50:09 -06:00
rdb
c17cb11dfa makepanda: enable more warnings by default 2018-05-30 11:12:15 +02:00
rdb
6b726fa697 general: fix various compiler warnings and issues exposed thereby 2018-05-30 11:09:35 +02:00
Psychotropos
3029780f88 dtoolutil: Don't assume RTLD_DI_ORIGIN and RTLD_SELF are present, fall back to using RTLD_DI_LINKMAP if necessary
Closes #334
2018-05-30 11:04:12 +02:00
Psychotropos
314cee133a dtoolbase: The bug in question is glibc-specific, treat it as such. 2018-05-30 09:07:16 +02:00
Sam Edwards
32e1ca2252 general: Fix several miscategorized EXPCL_PANDA_* macros 2018-05-29 22:49:35 -06:00
Sam Edwards
527e4840ff makepanda: Fix table alignment 2018-05-27 14:11:55 -06:00
Sam Edwards
a251c6dd8f general: Change HAVE_LOCKF to PHAVE_LOCKF
HAVE_LOCKF is already defined by pyconfig.h in
(at least) Python 3.6 - changing the macro name
here avoids warnings
2018-05-27 14:06:14 -06:00
Sam Edwards
24c8ef9887 general: Fix missing include 2018-05-27 14:06:08 -06:00
rdb
239f66cf11 makepanda: fix macOS compile error in CheckPandaVersion
See #327
2018-05-27 15:39:02 +02:00
rdb
8d84c58d73 express: explicitly declare defaulted Datagram copy/move ctor/assign
Fixes #329
2018-05-27 15:38:19 +02:00
rdb
3d49986ce2 char: fix crash during Character destructor (regression)
This was a regression in 0bb81a43c9e4fffb37cc2234c1b0fbae42020ceb which was not keeping an edge case in mind if a weak pointer is locked during object destruction.  This issue was fixed by 525a05ea2b1d00a1db901f883f1755943aeff33c, but that is not enough since it causes CharacterJointEffect::get_character() to return null now, so we need a separate method to check if a CharacterJointEffect belongs to a given character.  This is more efficient, too.

Fixes #330
2018-05-27 15:37:45 +02:00
rdb
f2d429b817 express: weakptr.lock() should return null during object destruction
This came up in #330; the Character destructor caused something to call lock() on a weak pointer to that character, which would induce a ref() and unref() pair, but since the refcount was 0, this would call the destructor and thereby create infinite recursion.

I considered instead calling mark_deleted() inside unref() so that the callbacks get to run before the object is actually deleted, and was_deleted() will become true as soon as unref() reaches 0.  However, this would require grabbing the lock in unref() to be fully thread-safe, since we would need to bring the refcount to 0 and mark the object as deleted in one atomic operation, so this would be an unacceptable general performance penalty.

Instead, WeakPointerTo::lock() now atomically increments the reference count if it is not already zero, and returns null otherwise.  This should be safe because the object cannot be deleted while the WeakReferenceList lock is held.
2018-05-27 15:37:03 +02:00
rdb
0de981d0b8 ai: make AICharacter reference counted
This lets one drop the reference to AICharacter after adding it to a flock or AIWorld without crashes.

Also replace the silly and inefficient custom-rolled linked list implementation of AICharPool with a vector, and add additional safety checks.

Fixes #318
2018-05-27 12:59:41 +02:00
Sam Edwards
0ce9dc98b1 general: Move inclusion of checkPandaVersion.h to dtoolbase
This includes it everywhere, meaning developers no longer must
remember to include it in each metalib init file.
2018-05-26 18:39:24 -06:00
Sam Edwards
35ab16d38f makepanda: Update checkPandaVersion.h
This makes it possible to include it multiple times in a single
translation unit, and/or multiple times in a single dynamic
library (and without excess code bloat, too).
2018-05-26 18:39:24 -06:00
Sam Edwards
339e1ce4d8 tests: Update the datagram tests 2018-05-26 18:36:46 -06:00
Sam Edwards
e4c9526e08 ffmpeg: Make read_packet return AVERROR_EOF
Newer versions of FFmpeg deprecate returning 0 to indicate
EOF, and instead request use of AVERROR_EOF.

The oldest supported versions of FFmpeg/libav will treat any
error code the same as returning 0.

Fixes #315
2018-05-26 15:17:43 -06:00
rdb
5c9705c21c pgraph: fix crash accessing python_tags via dict property
Fixes #326
2018-05-24 22:44:08 +02:00
rdb
ddc45e3529 tests: fix broken test case, add more WeakNodePath comparisons 2018-05-24 22:25:20 +02:00
rdb
ec04dbed0c gobj: fix static init ordering issue with VertexTransform cycler
This comes up when building with DEBUG_THREADS; there is a PipelineCycler created at static init time, and the type tracking in Pipeline won't work properly if the CData's parent's TypeHandle has not yet been initialized.
2018-05-24 21:40:48 +02:00
rdb
2e7bca90b0 express: fix PointerToArray coercibility regression, fix clear()
This was caused by the assignment operators not being visible to interrogate.
2018-05-24 21:39:54 +02:00
rdb
ae8e9d159d tests: add some unit tests for UpdateSeq 2018-05-24 21:39:05 +02:00
rdb
323ddc7d67 putil: fix UpdateSeq::fresh().is_special() return value 2018-05-24 21:37:58 +02:00
rdb
5e0ce969fe Work around clang 3.1 compile error with static constexpr
There is a bug in clang versions before 3.2 (including the one shipped with Xcode) that makes it give a "conflicting types" compile error when there is a static constexpr function defined outside the class.  The way to work around this is either to remove one of the "static" or "constexpr" keywords, or to simply put the definition inline.

See: https://stackoverflow.com/a/17494592/2135754

I would try and upgrade Xcode to version 5 to see if the problem is fixed, but the buildbot still runs OS X Lion (10.7) and the last version of Xcode that works on Lion is 4.6.3, so it seems easier to just apply these workarounds for now.
2018-05-24 14:34:03 +02:00
rdb
8eeab7a26a dxgsg9: fix compile error due to WeakPointerTo changes 2018-05-24 14:26:21 +02:00
rdb
49dfcb09b9 makepanda: refuse building with MSVC versions older than 2015
Panda3D no longer compiles with any version older than Visual Studio 2015 (14.0).

Closes #288
2018-05-23 23:43:36 +02:00
rdb
3077316782 general: use proper deleted funcs instead of stubs with asserts
This gives better compile-time diagnostics and saves on code, while also better communicating intent.
2018-05-23 23:35:27 +02:00
rdb
9fad3dba60 general: remove macros for compatibility with non-C++11 compilers
Now that we require MSVC 2015, we no longer need all this nonsense, so we can write cleaner code.
2018-05-23 23:33:05 +02:00
rdb
f45ddcab2f general: switch to C++11 Lockable semantics for mutexes
This renames acquire/release to lock/unlock in order to be compatible with std::lock_guard and std::unique_lock (which will eventually replace the *MutexHolder classes).  It will also allow us to typedef MutexImpl to std::mutex later on.
2018-05-23 20:37:56 +02:00
rdb
3653413cd4 bullet: fix BulletSoftBodyNode::get_node deadlock 2018-05-23 16:55:17 +02:00
rdb
3b4d12cb99 interrogate: also fall back to compare_to in Python 2
This is to create the same behaviour in Python 2 and 3.
2018-05-21 11:55:46 +02:00
rdb
8c80ff1681 Audio3DManager: remove sounds when attached object is deleted
This now uses WeakNodePaths in order to prevent holding a reference to the corresponding nodes.

Closes #145
2018-05-20 18:46:27 +02:00
rdb
941fda6ec3 pgraph: fix comparisons between WeakNodePath and NodePath
Previously it would only work correctly if the WeakNodePath appeared on the left side of the comparison operator.
2018-05-20 15:57:23 +02:00
rdb
14f118b672 pgraph: expose WeakNodePath to Python 2018-05-20 15:56:58 +02:00
rdb
140644d8b6 stdpy: add Python 3 stuff to glob module, remove re dependency 2018-05-20 11:50:32 +02:00
rdb
0bb81a43c9 express: make a thread safe weak pointer implementation (#321)
To access a WeakPointerTo in a thread-safe way, use something like this:

    if (auto ptr = weak_ptr.lock()) {
      ..use ptr as regular PointerTo
    }

The new implementation no longer needs a reference to be stored to all weak pointers on the WeakReferenceList; a mere count of weak pointers is sufficient.  Therefore, callbacks theoretically no longer require a WeakPointerTo to be constructed.

The WeakPointerTo class is not actually atomic; it could be made so, but I don't believe it's worth it at this time.
2018-05-15 13:40:21 +02:00
Sam Edwards
47f7d3f297 general: Add headers explaining the renamed config_*.h 2018-05-14 02:36:42 -06:00
Sam Edwards
c81229c1a8 pfmprogs: Rename config_pfm to config_pfmprogs 2018-05-14 02:36:42 -06:00
Sam Edwards
52e7c952b3 putil: Rename config_util to config_putil 2018-05-14 02:36:42 -06:00
Sam Edwards
87c11d8018 pstatclient: Rename config_pstats to config_pstatclient 2018-05-14 02:36:42 -06:00
rdb
6175e79c57 cppparser: fix infinite recursion stack overflow with enum classes 2018-05-06 22:21:24 +02:00
rdb
666591ff48 cppparser: fix compile warnings on MSVC 2018-05-06 22:19:33 +02:00
rdb
ed54856e9f makepanda: don't fail building Windows installer if Pmw is missing 2018-05-06 22:18:30 +02:00
rdb
549301d0f0 putil: keep reference to objects queued for writing
This prevents a crash when a reference counted object is destroyed right after a write_pointer call.

Fixes #310
2018-05-05 23:10:41 +02:00
rdb
8a98bf42a3 general: enable use of tie and tuple on macOS (from TR1, for now) 2018-05-05 23:09:39 +02:00
rdb
71eee6df3f showbase: make iris/fade/letterbox transitions awaitable
This allows using a coroutine to build up a more complex sequence including transitions (eg. scripted cutscene), as well as provide a standard way to register callbacks upon completion of the transition.
2018-05-05 23:05:50 +02:00
rdb
cf58de4d04 showbase: make base.movie() awaitable (by returning a future) 2018-05-05 23:02:11 +02:00
rdb
11e21af52c showbase: fix iris/fade transitions for extreme aspect ratios
Fixes #311
2018-05-05 22:08:52 +02:00