Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] #1927

Open
1 task done
Riya54671 opened this issue Oct 2, 2024 · 0 comments
Open
1 task done

[Bug] #1927

Riya54671 opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Riya54671
Copy link

Operating System

Windows

What's the issue you encountered?

1)Forward Declarations: GLFWwindow and ImGuiSettingsHandler are forward-declared but never used in the given code.
2)Missing Includes:There is no explicit inclusion of mutex, hex/ui/view.hpp might not include necessary types or libraries.
3)Magic Number for m_searchBarPosition:The variable m_searchBarPosition is initialized to 0, which is a magic number. It is better to define a meaningful constant.
4)Mutex Usage:The use of std::mutex for m_popupMutex suggests the possibility of multi-threaded access to m_popupsToOpen. Ensure the mutex is locked when modifying or accessing m_popupsToOpen.
5)Raw Pointer (m_window):GLFWwindow *m_window is a raw pointer. It should be managed with a smart pointer (e.g., std::unique_ptr) to avoid manual memory management issues.
6)No Explicit Copy or Move:The class has a pointer (m_window) and other resources like mutex and vectors, so implementing proper copy or move semantics is essential.
7)Redundant Member Variable:The variable m_windowTitleFull is introduced but not used within the visible scope.

How can the issue be reproduced?

The following issues can be fixed by:

  1. Remove the unused forward declarations if they are not used in the implementation.
    2)Ensure necessary standard headers are included, like for std::mutex, and verify hex/ui/view.hpp properly includes ImGuiExt::Texture and ImGuiExt::ImHexCustomData. If not, include them explicitly.
    3)Define a constant or set the value more descriptively.(m_searchBarPosition)
    4)Use std::lock_guard to handle the mutex safely and avoid race conditions.
    5)Use a std::unique_ptr for safer memory management.
  2. Add deleted or implemented copy and move constructors/assignment operators to prevent accidental misuse.
    7)If this variable is not required, remove it.(m_windowTitleFull)

ImHex Version

X.X.X

ImHex Build Type

  • Nightly or built from sources

Installation type

Portable

Additional context?

No response

@Riya54671 Riya54671 added the bug Something isn't working label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant