Ralf W. Grosse-Kunstleve
05c8b9b7a8
Automatic pre-commit run --all-files
and clang-tidy changes (NO manual changes).
2022-02-14 19:00:40 -08:00
Ralf W. Grosse-Kunstleve
e41fb99e7e
clang-tidy fixes (mostly manual) related to PR #3166
2021-08-14 12:45:50 -07:00
Ralf W. Grosse-Kunstleve
e2108546e1
Adding unit tests: 2 x test_std_make_shared_factory
...
Completes unit test coverage for the changed code in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
1b752f56c1
Adding unit test: test_multiple_registered_instances_for_same_pointee
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ab3c5134ad
Cleaning out debug code.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
146a925e4e
Resolving TODOs for from_unique_ptr
void_cast_raw_ptr
. Adding test to exercise the path through cast
. The path through init.h is missing a test that would fail if the flag is incorrect. The plan is to systematically cover all situations (there are many that are not exercised for shared_from_this).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ccd16a1a14
Adding test_pure_cpp_sft_raw_ptr (with 3 TODO: Fix), test_pure_cpp_sft_shd_ptr (works as desired).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
10abe15052
Automatic clang-tidy fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
48eb78ae77
Simpler and safe implementation based on new requirement: C++ (outside of the Python object) needs to hold a shared_ptr before shared_from_this is called. This is more similar to the existing implementation on current smart_holder HEAD, but still uses a weak_ptr to always return the same shared_ptr as long as C++ does not let it expire.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
b1d9f0d28f
Applying clang-tidy suggested fixes.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
adfd3e1700
Partial cleanup of tests. WIP. The cleanup uncovered a major problem.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bfd4c4893e
Leveraging new noop_deleter_acting_as_weak_ptr_owner
to retrieve released vptr
.
...
The placeholder `vptr` is never exposed anymore, therefore the externally visible `use_count`s are more intuitive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4b872febcc
Adding test_pass_released_shared_ptr_as_unique_ptr
, exercising new guard in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e04196e82b
Attempts to side-step various platform-specific issues.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
6214137c8d
Resolving gcc warning-as-error (many versions, old and new).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
553054b26b
Adding tests involving stashing shared_ptr
s. WIP.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4218213f29
nodiscard fix.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bf8d6a2900
First fully successful attempt to make shared_from_this
and trampolines play nicely.
...
Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.
2021-06-30 07:04:31 -07:00