Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed derived class unloading for plugins #181

Merged
merged 7 commits into from
Sep 3, 2018

Conversation

acki-m
Copy link
Contributor

@acki-m acki-m commented Aug 19, 2018

Following use case:

  1. A plugin: "A" creates a new class derived from some base class in a dynamic library: "B".
  2. An applications loads now B implicit (its always in memory) and loads "A" via RTTR
  3. When "A" gets unloaded the derived class is still connected to the library "B"
    So when I retrieve all derived classes from a library of B, I still get the derived type as returned library.

This commit will fix this.

Following use case:
1. A plugin: "A" creates a new class derived from some base class in a dynamic library: "B".
2. An applications loads now B implicit (its always in memory) and loads "A" via RTTR
3. When "A" gets unloaded the derived class is still connected to the library "B"
So when I retrieve all derived classes from a library of B, I still get the derived type as returned library.

This commit will fix this.
@coveralls
Copy link

coveralls commented Aug 19, 2018

Coverage Status

Coverage decreased (-0.1%) to 93.062% when pulling d996593 on acki-m:fix-plugin-unload-with-base-class into b071436 on rttrorg:master.

The base_types has to be provided as argument explicitely and cannot be retrieve via the type_data itself,
because the `class_data` which holds the base_types information cannot be retrieve via the function `get_class_data`
anymore because the containing std::unique_ptr is already destroyed.
…ger,

therefore we have to can use the class_data from the type via the getter directly.
In other case the type_data can be deregistered when the class_data is destroyed, then we use the this pointer.
* avoided creation of class_data for every type (pointer types)
No more unique_ptr, it holds the data now directly.
So we can avoid handling the creation and destroying logic.
At the moment the class data was created always even for simple types like "int".
However, this not needed memory is not sooo much, compared to the simplified code.
@acki-m
Copy link
Contributor Author

acki-m commented Sep 3, 2018

fixes #163

@acki-m acki-m merged commit 4d32438 into rttrorg:master Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants