Repository navigation
Conversation
Public headers used void* for GLFW windows/cursors and NanoVG contexts to avoid including their headers, which needed casts everywhere and cast GLFW callbacks to other function pointer types. Forward declare the structs instead, so headers still do not depend on GLFW or NanoVG. - OGUIWindow::glfw_window, vg and cursors are typed pointers - GLFW callbacks are registered with their real signatures - Drawing helpers, OGUIFile, timeline and perf graph take NVGcontext* - setExternal2DDraw passes NVGcontext*, functions taking void* still work Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imshow, plot2D, plot3D and setImage took void* or Mat*, losing type checking. They now take const cv::Mat& (data is copied as before) and const references for strings and labels. The pointer versions are kept as deprecated overloads so existing code keeps compiling with a warning. OGUIPlotArea and OGUI3D constructors and replot take const cv::Mat& directly. Requires C++14 for [[deprecated]]. Examples, README and hello world docs use the new API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Objects created by the library were allocated with new and never released. User created areas and widgets are still owned by the user. - Add virtual destructors to OGUIArea and OGUIWidget - OGUIWindow owns its main layout and file browser - OGUICVWindow owns the form, layouts and areas created by imshow/plots - The file browser owns its file lists, folder changes no longer leak and no longer use a file after its list is released - OGUIFile keeps its preview in a Mat, it returned a pointer to a local Mat already released (heap-use-after-free), and returns NULL when the image can not be read instead of throwing - Do not let nanovg free the embedded fonts, destroying a window called free() on static data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Do not exit the program when the mount list can not be read - Close the folder when a file can not be read and report errors to stderr - Show the requested path when it can not be resolved - Remove the debug new line printed for each file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The API changes are source compatible but not ABI compatible, the new SOVERSION makes applications built with 1.x fail to load instead of crashing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imshow used 4 channel images as RGBA, so blue and red were swapped for BGRA images loaded or created with OpenCV. Images that are not 8 bit or have 2 channels were uploaded with a wrong size or no data, now they print an error and are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- test_render draws images, every plot type, widgets and progress from the process thread and reads the framebuffer to check the image colors and the 3D surface depth - test_dialogs checks that popup and file browser return in the UI thread and release the process thread when the window is closed - CI on Ubuntu 24.04 with Xvfb and Mesa: release with examples, static library, bundled GLFW, AddressSanitizer + UBSan and ThreadSanitizer - Install the library and build an application with find_package - Tests are built with -DOGUI_BUILD_TESTS=ON Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Point 4 of the code review: make the public API type safe and give clear ownership to objects created by the library. It also adds automated tests and CI, which validate all the changes.
Typed pointers instead of
void*GLFWwindow*,NVGcontext*), headers still do not include GLFW or NanoVGsetExternal2DDrawpassesNVGcontext*; existing functions takingvoid*still workconst cv::Mat&in image and plot APIsimshow,plot2D,plot3DandOGUIImageArea::setImagetakeconst cv::Mat&(data is copied as before)[[deprecated]]overloads, soimshow("x", &frame)keeps compiling with a warningOGUIPlotArea/OGUI3Dconstructors andreplottakeconst cv::Mat&directly[[deprecated]])Ownership
OGUIAreaandOGUIWidgetOGUIWindowowns its main layout and file browser,OGUICVWindowowns the areas it creates, the file browser owns its file lists (std::unique_ptr). User created areas and widgets are still owned by the userMemory bugs found on the way (AddressSanitizer)
OGUIFile::getPreviewreturned a pointer into a localMatalready released (heap-use-after-free on every image preview)free()on the static embedded fonts (nanovg was told to own them)File browser errors
/proc/mountscan not be read, close the folder on read errors and remove the debug new line printed for each fileVersion 2.0.0
libOpenCVGUI.so.2)Tests and CI
test_renderdraws images, every plot type, widgets and progress from the process thread and reads the framebuffer: image colors must be right and the 3D surface must write depthtest_dialogschecks that popup and file browser return in the UI thread and release the process thread when the window is closedfind_package(OpenCVGUI 2.0)-DOGUI_BUILD_TESTS=ONimshowwith 4 channel images (bug found by the tests, also in master)Notes
glfw), it will be fixed with the Python wheel workdocs/docs/api.mdis generated by Doxygen and still shows the old signatures, it needs to be regeneratedTest plan
🤖 Generated with Claude Code