mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
fix: Error when opening a file
This commit is contained in:
@@ -8,7 +8,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void registerProviders() {
|
||||
|
||||
ContentRegistry::Provider::add<prv::GDBProvider>("hex.builtin.provider.file", false);
|
||||
ContentRegistry::Provider::add<prv::FileProvider>("hex.builtin.provider.file", false);
|
||||
ContentRegistry::Provider::add<prv::GDBProvider>("hex.builtin.provider.gdb");
|
||||
ContentRegistry::Provider::add<prv::DiskProvider>("hex.builtin.provider.disk");
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace hex::plugin::builtin::prv {
|
||||
|
||||
bool FileProvider::isAvailable() const {
|
||||
#if defined(OS_WINDOWS)
|
||||
return this->m_file != nullptr && this->m_mapping != nullptr && this->m_mappedFile != nullptr;
|
||||
return this->m_file != INVALID_HANDLE_VALUE && this->m_mapping != INVALID_HANDLE_VALUE && this->m_mappedFile != nullptr;
|
||||
#else
|
||||
return this->m_file != -1 && this->m_mappedFile != nullptr;
|
||||
#endif
|
||||
|
||||
@@ -481,7 +481,7 @@ namespace hex::plugin::builtin {
|
||||
saveAs();
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.close"_lang, "", false, providerValid && provider->isAvailable())) {
|
||||
if (ImGui::MenuItem("hex.builtin.view.hexeditor.menu.file.close"_lang, "", false, providerValid)) {
|
||||
EventManager::post<EventFileUnloaded>();
|
||||
ImHexApi::Provider::remove(ImHexApi::Provider::get());
|
||||
providerValid = false;
|
||||
@@ -728,6 +728,8 @@ namespace hex::plugin::builtin {
|
||||
fileProvider->setPath(path);
|
||||
if (!fileProvider->open()) {
|
||||
View::showErrorPopup("hex.builtin.view.hexeditor.error.open"_lang);
|
||||
ImHexApi::Provider::remove(provider);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void ViewSettings::drawContent() {
|
||||
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX));
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(500, 300) * SharedData::globalScale, ImGuiCond_Always);
|
||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
|
||||
if (ImGui::BeginTabBar("settings")) {
|
||||
|
||||
Reference in New Issue
Block a user