mirror of https://github.com/WerWolv/ImHex.git
fix: Provider information in information view always showing info from current provider
This commit is contained in:
parent
d5c8021b41
commit
58441634d6
|
@ -33,6 +33,7 @@ namespace hex::plugin::builtin {
|
|||
|
||||
Region m_analysisRegion = { 0, 0 };
|
||||
Region m_analyzedRegion = { 0, 0 };
|
||||
prv::Provider *m_analyzedProvider = nullptr;
|
||||
|
||||
std::string m_dataDescription;
|
||||
std::string m_dataMimeType;
|
||||
|
|
|
@ -41,8 +41,11 @@ namespace hex::plugin::builtin {
|
|||
}
|
||||
});
|
||||
|
||||
EventProviderDeleted::subscribe(this, [this](const auto*) {
|
||||
m_dataValid = false;
|
||||
EventProviderDeleted::subscribe(this, [this](const auto *provider) {
|
||||
if (provider == m_analyzedProvider) {
|
||||
m_dataValid = false;
|
||||
m_analyzedProvider = nullptr;
|
||||
}
|
||||
});
|
||||
|
||||
ContentRegistry::FileHandler::add({ ".mgc" }, [](const auto &path) {
|
||||
|
@ -69,6 +72,8 @@ namespace hex::plugin::builtin {
|
|||
m_analyzerTask = TaskManager::createTask("hex.builtin.view.information.analyzing", 0, [this](auto &task) {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
m_analyzedProvider = provider;
|
||||
|
||||
if ((m_analyzedRegion.getStartAddress() >= m_analyzedRegion.getEndAddress()) || (m_analyzedRegion.getEndAddress() > provider->getActualSize())) {
|
||||
m_analyzedRegion = { provider->getBaseAddress(), provider->getActualSize() };
|
||||
}
|
||||
|
@ -170,7 +175,7 @@ namespace hex::plugin::builtin {
|
|||
ImGui::NewLine();
|
||||
}
|
||||
|
||||
if (!m_analyzerTask.isRunning() && m_dataValid) {
|
||||
if (!m_analyzerTask.isRunning() && m_dataValid && m_analyzedProvider != nullptr) {
|
||||
|
||||
// Provider information
|
||||
ImGuiExt::Header("hex.builtin.view.information.provider_information"_lang, true);
|
||||
|
@ -181,7 +186,7 @@ namespace hex::plugin::builtin {
|
|||
|
||||
ImGui::TableNextRow();
|
||||
|
||||
for (auto &[name, value] : provider->getDataDescription()) {
|
||||
for (auto &[name, value] : m_analyzedProvider->getDataDescription()) {
|
||||
ImGui::TableNextColumn();
|
||||
ImGuiExt::TextFormatted("{}", name);
|
||||
ImGui::TableNextColumn();
|
||||
|
|
Loading…
Reference in New Issue