Skip to content

No error checking on function-based app startup #3444

@tleeuwenburg

Description

@tleeuwenburg

This was originally reported as an app startup error; see this comment below for the diagnosis and proposed fix for the problem


Describe the bug

I am experiencing a null pointer error, stack trace below.

I'm a toga newbie, so I'm not sure how to create a simple reproduction example for this error. I'm not sure how to build toga for myself in order to get in and debug what's going on either. I am presuming the issue is most likely in my own code, but the error message isn't very helpful in identifying which part of my code is at fault. I don't know what information is helpful to the team in tracking this one down.

Exception ignored on calling ctypes callback function: <function CFTimerHandle._cf_timer_callback.<locals>.cf_timer_callback at 0x1139d58a0>
Traceback (most recent call last):
  File "/<path>/env/name/lib/python3.11/site-packages/rubicon/objc/eventloop.py", line 183, in cf_timer_callback
    callback(*args)
  File "<path>/env/name/lib/python3.11/site-packages/rubicon/objc/eventloop.py", line 334, in _callback
    context.run(callback, *args)
  File "<path>/env/name/lib/python3.11/site-packages/toga/app.py", line 630, in _startup
    self.startup()
  File "<path>/env/name/lib/python3.11/site-packages/toga/app.py", line 672, in startup
    self.main_window.content = self._startup_method(self)
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<path>/dev/env/name/lib/python3.11/site-packages/toga/window.py", line 407, in content
    widget.app = self.app
    ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'app'

Steps to reproduce

I'm just running a fairly simple GUI app. This message appears in the terminal when I do so. Actual GUI functionality seems fine, but I'm just at an early prototyping stage at the moment. My code probably contains some bugs.

Expected behavior

The error message should make more sense.

Screenshots

No response

Environment

  • Operating System: macos
  • Python version: 3.11.11
  • Software versions:
    • Briefcase: n/a
    • Toga: 0.5.0
    • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.good first issueIs this your first time contributing? This could be a good place to start!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions