mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 21:47:40 -05:00
Fix crash when moving around certain views
This commit is contained in:
@@ -23,7 +23,7 @@ namespace hex::lang {
|
||||
|
||||
std::optional<u64> parseInt(std::string_view string) {
|
||||
u64 integer = 0;
|
||||
u8 base = 10;
|
||||
u8 base;
|
||||
|
||||
std::string_view numberData;
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace hex::prv {
|
||||
}
|
||||
|
||||
bool FileProvider::isReadable() {
|
||||
return this->m_readable;
|
||||
return isAvailable() && this->m_readable;
|
||||
}
|
||||
|
||||
bool FileProvider::isWritable() {
|
||||
return this->m_writable;
|
||||
return isAvailable() && this->m_writable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "views/view_hashes.hpp"
|
||||
|
||||
#include "providers/provider.hpp"
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <vector>
|
||||
@@ -16,19 +18,19 @@ namespace hex {
|
||||
|
||||
|
||||
void ViewHashes::createView() {
|
||||
static bool invalidate = false;
|
||||
|
||||
if (!this->m_windowOpen)
|
||||
return;
|
||||
|
||||
static bool invalidate = false;
|
||||
|
||||
if (ImGui::Begin("Hashing", &this->m_windowOpen)) {
|
||||
ImGui::BeginChild("##scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav);
|
||||
|
||||
ImGui::NewLine();
|
||||
|
||||
if (this->m_dataProvider != nullptr && this->m_dataProvider->isAvailable()) {
|
||||
|
||||
ImGui::Combo("Hash Function", &this->m_currHashFunction, HashFunctionNames, sizeof(HashFunctionNames) / sizeof(const char*));
|
||||
ImGui::Combo("Hash Function", &this->m_currHashFunction, HashFunctionNames,
|
||||
sizeof(HashFunctionNames) / sizeof(const char *));
|
||||
|
||||
ImGui::NewLine();
|
||||
ImGui::Separator();
|
||||
@@ -115,10 +117,9 @@ namespace hex {
|
||||
invalidate = true;
|
||||
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ViewHashes::createMenu() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "views/view_hexeditor.hpp"
|
||||
|
||||
#include "providers/provider.hpp"
|
||||
#include "providers/file_provider.hpp"
|
||||
|
||||
namespace hex {
|
||||
|
||||
@@ -48,23 +48,24 @@ namespace hex {
|
||||
if (!this->m_windowOpen)
|
||||
return;
|
||||
|
||||
ImGui::Begin("Pattern", &this->m_windowOpen, ImGuiWindowFlags_None);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
if (ImGui::Begin("Pattern", &this->m_windowOpen, ImGuiWindowFlags_None)) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
|
||||
auto size = ImGui::GetWindowSize();
|
||||
size.y -= 50;
|
||||
ImGui::InputTextMultiline("Pattern", this->m_buffer, 0xFFFF, size, ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_CallbackEdit,
|
||||
[](ImGuiInputTextCallbackData* data) -> int {
|
||||
auto _this = static_cast<ViewPattern*>(data->UserData);
|
||||
auto size = ImGui::GetWindowSize();
|
||||
size.y -= 50;
|
||||
ImGui::InputTextMultiline("Pattern", this->m_buffer, 0xFFFF, size, ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_CallbackEdit,
|
||||
[](ImGuiInputTextCallbackData* data) -> int {
|
||||
auto _this = static_cast<ViewPattern*>(data->UserData);
|
||||
|
||||
_this->parsePattern(data->Buf);
|
||||
_this->parsePattern(data->Buf);
|
||||
|
||||
return 0;
|
||||
}, this
|
||||
);
|
||||
return 0;
|
||||
}, this
|
||||
);
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "views/view_pattern_data.hpp"
|
||||
|
||||
#include "providers/provider.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace hex {
|
||||
@@ -48,8 +50,8 @@ namespace hex {
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void ViewPatternData::createMenu() {
|
||||
|
||||
Reference in New Issue
Block a user