1
0
mirror of synced 2024-11-12 02:00:52 +01:00

fix: Various invalid iterator and container accesses

This commit is contained in:
WerWolv 2023-01-01 01:01:24 +01:00
parent 921bdd9e3b
commit 87ed0d31d4
8 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(libimhex)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/imgui ${CMAKE_CURRENT_BINARY_DIR}/external/imgui)

View File

@ -80,7 +80,9 @@ namespace hex {
if (iter != s_tokenStore.end()) {
s_events.remove(*iter->second);
s_tokenStore.erase(iter);
}
}
template<typename E>

View File

@ -189,7 +189,7 @@ namespace hex::fs {
#endif
}
constexpr std::vector<std::fs::path> appendPath(std::vector<std::fs::path> paths, const std::fs::path &folder) {
std::vector<std::fs::path> appendPath(std::vector<std::fs::path> paths, const std::fs::path &folder) {
for (auto &path : paths)
path = path / folder;

View File

@ -69,7 +69,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE libimhex)
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug")

View File

@ -42,7 +42,7 @@ namespace hex::plugin::builtin {
}
void ViewDataInspector::drawContent() {
if (this->m_dataValid) {
if (this->m_dataValid && !this->m_updateTask.isRunning()) {
this->m_dataValid = false;
this->m_cachedData = std::move(this->m_workData);
}

View File

@ -140,7 +140,7 @@ namespace hex::plugin::builtin {
std::array<ImU64, 256> blockValueCounts = { 0 };
const auto blockCount = provider->getSize() / this->m_blockSize;
const auto blockCount = (provider->getSize() / this->m_blockSize) + 1;
this->m_blockTypeDistributions.fill({});
this->m_blockEntropy.clear();

View File

@ -22,12 +22,13 @@ namespace hex::plugin::builtin {
if (ImGui::IsMouseClicked(0) && ImGui::IsItemActivated() && this->m_dragStartIterator == tools.end())
this->m_dragStartIterator = iter;
if (!ImGui::IsMouseDown(0))
this->m_dragStartIterator = tools.end();
if (!ImGui::IsItemHovered() && this->m_dragStartIterator == iter) {
detached = true;
}
if (!ImGui::IsMouseDown(0))
this->m_dragStartIterator = tools.end();
}
}
}

View File

@ -23,7 +23,7 @@ if (WIN32)
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug")