wxColourDialog::ShowModal() causes 100% CPU usage on macOS (Issue #26804)

12 views
Skip to first unread message

David Brown

unread,
Aug 8, 2026, 10:58:12 AM (2 days ago) Aug 8
to wx-...@googlegroups.com, Subscribed
lhz07 created an issue (wxWidgets/wxWidgets#26804)

Bug description:

Calling ShowModal() on a wxColourDialog causes the application to continuously use 100% of one CPU core while the colour dialog is open.

Expected vs observed behaviour:

Expected behaviour:

Opening a wxColourDialog with ShowModal() should not cause excessive CPU usage while the dialog is idle. CPU usage should remain low when there is no user interaction.

Observed behaviour:

After wxColourDialog::ShowModal() is called, the application continuously uses 100% of one CPU core, even when the colour dialog is idle and no user interaction is taking place.

The high CPU usage stops when the colour dialog is closed.

As a comparison, when using NSColorPanel directly through Objective-C/AppKit and calling runModalForWindow:, CPU usage is negligible while the colour panel is idle. This suggests that the high CPU usage is specific to the wxWidgets implementation rather than an inherent behaviour of the native macOS color panel.

Patch or snippet allowing to reproduce the problem:

#include <wx/button.h>
#include <wx/colordlg.h>
#include <wx/colourdata.h>
#include <wx/sizer.h>
#include <wx/wx.h>

class MyApp : public wxApp {
public:
  bool OnInit() override;
};

wxIMPLEMENT_APP(MyApp);

class MyFrame : public wxFrame {
public:
  MyFrame();
private:
  void OnSelect(wxCommandEvent &event);
};

bool MyApp::OnInit() {
  MyFrame *frame = new MyFrame();
  frame->Show(true);
  return true;
}

MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, "Hello World") {
  wxMenuBar *menuBar = new wxMenuBar;
  SetMenuBar(menuBar);
  auto sizer = new wxBoxSizer(wxVERTICAL);
  auto getColor = new wxButton(this, wxID_ANY, "select color");
  getColor->Bind(wxEVT_BUTTON, &MyFrame::OnSelect, this);
  sizer->Add(getColor, 1, wxALIGN_CENTER);
  this->SetSizer(sizer);
}

void MyFrame::OnSelect(wxCommandEvent &event) {
  wxColourData data;
  data.SetColour(wxColour(0, 0, 255));
  wxColourDialog dlg(this, &data);
  dlg.ShowModal();
}

To Reproduce:

  1. Compile and run the program.
  2. Click the "select color" button to open the wxColourDialog.
  3. Open macOS Activity Monitor and observe the CPU usage of the application.
  4. The application continuously consumes approximately 100% of one CPU core while the colour dialog is open and idle.

Platform and version information

  • wxWidgets version you use: 3.3.3
  • wxWidgets port you use: wxOSX
  • OS and its version: macOS 15.7.3


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26804@github.com>

VZ

unread,
Aug 9, 2026, 12:31:03 PM (14 hours ago) Aug 9
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26804)

Can you check what's going on under debugger? It probably keeps generating/processing some event or doing something during idle time but I don't know what it could be.

Also, I guess the problem is reproducible in the dialogs sample (which has a menu item to show this dialog) without any modifications.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26804/5232553434@github.com>

Reply all
Reply to author
Forward
0 new messages