After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668753 - can't reopen hamster applet after closing it: 'NoneType' object has no attribute 'show' in main
can't reopen hamster applet after closing it: 'NoneType' object has no attrib...
Status: RESOLVED FIXED
Product: hamster-applet
Classification: Deprecated
Component: general
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: hamster-applet-maint
hamster-applet-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-26 15:26 UTC by James Strandboge
Modified: 2012-02-10 20:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for 668753 (949 bytes, patch)
2012-01-26 15:28 UTC, James Strandboge
reviewed Details | Review

Description James Strandboge 2012-01-26 15:26:36 UTC
Forwarded from Ubuntu:

I can start Hamster from the Launcher, and use it normally. If I close the main window eg by pressing Escape, it closes, and the icon is inactive (loses the little arrow) in my Launcher. If I click it again, it does not start, I get an apport window, and I see this traceback in .xsession-errors:

Traceback (most recent call last):
  • File "/usr/bin/hamster-time-tracker", line 612 in <module>
    getattr(server, window)()
  • File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 68 in __call__
    return self._proxy_method(*args, **keywords)
  • File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 143 in __call__
    **keywords)
  • File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 630 in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.AttributeError: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/bin/hamster-time-tracker", line 562, in main
    self.app.window.show()
AttributeError: 'NoneType' object has no attribute 'show'

I can see there are still hamster processes running:

 6815 ? Sl 0:04 python /usr/bin/hamster-time-tracker
 6821 ? S 0:00 /usr/bin/python /usr/bin/hamster-service

I think this bug is something to do with connecting to them, or restarting them.

If I kill them manually then I can start Hamster again.
Comment 1 James Strandboge 2012-01-26 15:27:14 UTC
Rick Spencer had the following to say in a comment:
I thing what may be going on is when the window is being destroyed:
    def close_window(self, *args):
        self.save_window_position()
        self.window.destroy()
        self.window = None
        self.show_in_tray()

    def on_delete_window(self, event, data):
        self.save_window_position()
        self.window.destroy()
        self.window = None
        self.show_in_tray()

The app object is not destroyed. So then on re-entrancy:
    @dbus.service.method("org.gnome.Hamster.WindowServer")
    def main(self):
        if self.app:
            self.app.window.show()
            self.app.window.present()
        else:
            self.app = ProjectHamster()

since there is an application object, it assumes there is a window object. I suspect the right fix is to test if the self.app.window is not None, and recreate the window if necessary. It may also be simply to hide self.window instead of destroy it.
Comment 2 James Strandboge 2012-01-26 15:28:26 UTC
Created attachment 206194 [details] [review]
Fix for 668753

Based on Rick's analysis, I created the following patch that seems to work well.
Comment 3 Toms Bauģis 2012-02-10 20:39:34 UTC
Review of attachment 206194 [details] [review]:

thanks, the current codebase has moved out the windowserver in an dbus-instantiable service and thus this bug has been solved by going around the problem