mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Crash when closing provider that was used in view provider
This commit is contained in:
@@ -3,12 +3,21 @@
|
||||
#include <hex/providers/provider.hpp>
|
||||
#include <hex/helpers/fmt.hpp>
|
||||
|
||||
#include <hex/api/event.hpp>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
class ViewProvider : public hex::prv::Provider {
|
||||
public:
|
||||
explicit ViewProvider() = default;
|
||||
~ViewProvider() override = default;
|
||||
explicit ViewProvider() {
|
||||
EventManager::subscribe<EventProviderClosing>(this, [this](prv::Provider *provider, bool*) {
|
||||
if (this->m_provider == provider)
|
||||
ImHexApi::Provider::remove(this, true);
|
||||
});
|
||||
}
|
||||
~ViewProvider() override {
|
||||
EventManager::unsubscribe<EventProviderClosing>(this);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool isAvailable() const override {
|
||||
if (this->m_provider == nullptr)
|
||||
|
||||
Reference in New Issue
Block a user