Skip to content

High CPU use when showing CustomDialogs #4574

Closed
@dweymouth

Description

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

Showing a custom confirm dialog using dialog.ShowCustomConfirm uses high CPU while the dialog is displayed. After dismissing the dialog the CPU settles back down to normal.

How to reproduce

Run the example code, with an Activity Monitor/Task Manager/etc window open, and click the button to show the custom confirm dialog

Screenshots

No response

Example code

package main

import (
	"log"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/widget"
)

func main() {
	myApp := app.New()
	myWindow := myApp.NewWindow("Custom Confirm CPU bug")

	button := widget.NewButton("Show dialog", func() {
		dialog.ShowCustomConfirm("Custom confirm", "Confirm text", "Dismiss text",
			widget.NewLabel("Content"), func(b bool) {
				log.Printf("Confirm dismissed with value %v\n", b)
			}, myWindow)
	})
	myWindow.SetContent(container.NewCenter(button))
	myWindow.Resize(fyne.NewSize(400, 300))
	myWindow.ShowAndRun()
}

Fyne version

2.4.3

Go compiler version

go1.21.1

Operating system and version

macOS Ventura M2

Additional Information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingoptimizationTickets that could help Fyne apps run faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions