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

WeakrefCallable Class implementation is faulty #2163

Closed
proneon267 opened this issue Oct 21, 2023 · 3 comments · Fixed by #2167
Closed

WeakrefCallable Class implementation is faulty #2163

proneon267 opened this issue Oct 21, 2023 · 3 comments · Fixed by #2167
Labels
bug A crash or error in behavior. windows The issue relates to Microsoft Windows support.

Comments

@proneon267
Copy link
Contributor

proneon267 commented Oct 21, 2023

Describe the bug

The WeakrefCallable class implemented in #2066 appears to be a faulty one. As such the items in the app menu do not work when clicked on. Moreover, the weakref.ref() calls added to the different places also appears to be problematic. The event handlers wrapped in weakref also do not fire.

Steps to reproduce

  1. Clone the latest main branch of the toga repository.
  2. Install the cloned repo.
  3. Create a default helloworld project in briefcase.
  4. Run the project in dev mode.
  5. Try to click on the menu items like "Exit".
  6. The handlers attached to the menu items won't fire.

Expected behavior

The app menu items like "Exit" should fire their attached handlers.

Screenshots

No response

Environment

  • Operating System: Windows 11
  • Python version: 3.10.6
  • Software versions:
    • Briefcase: Latest
    • Toga: Latest from the main branch
    • ...

Logs


Additional context

No response

@proneon267 proneon267 added the bug A crash or error in behavior. label Oct 21, 2023
@proneon267 proneon267 changed the title The app menu items donot work on windows WeakrefCallable Class implementation is faulty Oct 22, 2023
@freakboy3742 freakboy3742 added the windows The issue relates to Microsoft Windows support. label Oct 22, 2023
@freakboy3742
Copy link
Member

Thanks for the report. The weakref handlers are working fine AFAICT - the problem is that they're passing out of scope and being garbage collected.

I've just added #2167 which should fix the problem.

@freakboy3742
Copy link
Member

I can't find any other event handlers that aren't working - they should all be tested by the testbed test suite. Menus and toolbars fell through the cracks because they're tested as part of toga.App, which is what #2075 will add tests for.

If you've got any examples of events that aren't working, let us know and we can investigate - but it's almost certainly the same cause as the menu/toolbar issue.

@proneon267
Copy link
Contributor Author

Thanks, I'll report back if I find any such events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. windows The issue relates to Microsoft Windows support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants