Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new cross-platform API to allow applications to display progress indicators directly on their taskbar or dock icons. This feature significantly enhances user experience by providing visual feedback for long-running operations, making it easier for users to monitor application status without needing to keep the application window in focus. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new cross-platform API, setTaskbarProgress, to the AWindow class, enabling the display of progress indicators on taskbars or docks across Windows, macOS, and Linux. The implementation includes platform-specific logic for each OS, and an example usage in the progress bar UI example. The review comments highlight several issues: a critical memory leak and deprecated API usage in the macOS implementation, an empty stub for the GTK platform that contradicts the documentation, a COM object resource leak in the Windows implementation, and an unused header inclusion in the X11 platform abstraction.
| void AWindow::setTaskbarProgress(aui::float_within_0_1 p) { | ||
| if (!mHandle) return; | ||
|
|
||
| NSDockTile* dockTile = [NSApp dockTile]; | ||
| if (p == 0.0f) { | ||
| [dockTile setProgressIndicator:nil]; | ||
| [dockTile setProgress:-1.0]; | ||
| } else { | ||
| NSProgressIndicator* progressIndicator = [[NSProgressIndicator alloc] init]; | ||
| [progressIndicator setIndeterminate:NO]; | ||
| [progressIndicator setMinValue:0.0]; | ||
| [progressIndicator setMaxValue:1.0]; | ||
| [progressIndicator setDoubleValue:p]; | ||
| [dockTile setProgressIndicator:progressIndicator]; | ||
| [dockTile setProgress:p]; | ||
| } | ||
| } |
There was a problem hiding this comment.
The current implementation for setTaskbarProgress on macOS has a critical issue. The NSProgressIndicator object is created with [[NSProgressIndicator alloc] init] but is never released. According to Apple's documentation for -[NSDockTile setProgressIndicator:], the dock tile does not take ownership of the indicator object. This leads to a memory leak if not using ARC, or a dangling pointer and potential crash if using ARC, as the object will be deallocated at the end of the function's scope.
Furthermore, the use of setProgressIndicator: is deprecated since macOS 12 and is likely redundant, as [dockTile setProgress:p] should be sufficient to display a progress bar.
I suggest simplifying the implementation to avoid these issues. The following implementation is safer, simpler, and uses the modern API:
void AWindow::setTaskbarProgress(aui::float_within_0_1 p) {
if (!mHandle) return;
NSDockTile* dockTile = [NSApp dockTile];
if (p == 0.0f) {
[dockTile setProgressIndicator:nil];
[dockTile setProgress:-1.0];
} else {
[dockTile setProgress:p];
}
}
| gtk_window_present(nativeHandle(window)); | ||
| } | ||
|
|
||
| void PlatformAbstractionGtk::setTaskbarProgress(AWindow &window, aui::float_within_0_1 p) {} |
There was a problem hiding this comment.
The implementation of setTaskbarProgress is currently an empty stub. This means the taskbar progress feature will not work on GTK-based desktop environments like GNOME. This contradicts the documentation in AWindow.h which states the feature works on GNOME/Cinnamon.
Please either implement this feature for GTK or update the documentation to reflect its current limitations.
| * @details | ||
| * On Windows, displays progress on the taskbar button. | ||
| * On macOS, displays progress on the dock icon. | ||
| * On Linux, works on desktop environments like GNOME/Cinnamon. |
There was a problem hiding this comment.
you didn't mention KDE 🙃
There was a problem hiding this comment.
so you should document KDEs behaviour
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a cross-platform setTaskbarProgress API to show progress on the taskbar or dock across Windows, macOS, and Linux. While the implementation covers all major platforms, several issues need addressing: the X11 implementation risks a crash by passing a potential null pointer from std::getenv to std::string_view and should avoid log flooding; the macOS implementation uses non-standard NSDockTile methods that may cause compilation or runtime failures; and the Win32 implementation uses a static COM pointer which can lead to crashes during application shutdown. An unused include was also identified in the X11 source file.
| if (std::string_view(std::getenv("XDG_CURRENT_DESKTOP")) == "KDE") { | ||
| ALogger::warn("KDE") << "setTaskbarProgress() is not working on KDE"; | ||
| return; | ||
| } |
There was a problem hiding this comment.
std::getenv can return nullptr if the environment variable is not set. Passing nullptr to the std::string_view constructor is undefined behavior and will likely cause a crash. Additionally, logging a warning every time this function is called on KDE will flood the logs if the progress is updated frequently (e.g., during an animation). It is better to check for nullptr and log the warning only once.
if (const char* desktop = std::getenv("XDG_CURRENT_DESKTOP"); desktop && std::string_view(desktop) == "KDE") {
static bool warned = false;
if (!warned) {
ALogger::warn("KDE") << "setTaskbarProgress() is not working on KDE";
warned = true;
}
return;
}| [dockTile setProgressIndicator:nil]; | ||
| [dockTile setProgress:-1.0]; | ||
| } else { | ||
| [dockTile setProgress:p]; |
There was a problem hiding this comment.
NSDockTile does not have setProgressIndicator: or setProgress: methods in the standard AppKit API. These appear to be private APIs, which are generally discouraged as they can break with OS updates. Unless these are provided by a custom category defined elsewhere in the project, this code will fail to compile or cause a runtime crash. The standard way to display progress on the Dock icon is to assign a custom NSView to the contentView property of the NSDockTile.
| static AComPtr<ITaskbarList3> pTaskbar; | ||
| if (!pTaskbar) { | ||
| HRESULT hr = CoCreateInstance( | ||
| CLSID_TaskbarList, nullptr, | ||
| CLSCTX_INPROC_SERVER, | ||
| IID_PPV_ARGS(&pTaskbar) | ||
| ); | ||
| if (FAILED(hr)) return; | ||
| pTaskbar->HrInit(); | ||
| } |
There was a problem hiding this comment.
Using a static AComPtr for a COM object can lead to a crash or hang during application exit. The static object's destructor (which calls Release()) may run after CoUninitialize() has been called. It is safer to manage the lifetime of the COM object such that it is released before COM is uninitialized, or use a local variable if the overhead of CoCreateInstance is acceptable for your performance requirements.
| #include "AUI/Platform/ARenderingContextOptions.h" | ||
| #include "OpenGLRenderingContextX11.h" | ||
| #include "SoftwareRenderingContextX11.h" | ||
| #include "AUI/Platform/linux/ADBus.h" |
There was a problem hiding this comment.
ADBus need to work with (KDE), this template was removed
…essbar # Conflicts: # examples/7guis/flight_booker/CMakeLists.txt
|
Please address or comment PR feedback |

solves: #57