plugin disable function does not get called when exaile exits

Bug #409557 reported by Oben Sonne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
Medium
Adam Olsen

Bug Description

Exaile version: 0.2.99.3+ (bzr revision 2326)

Distro: Ubuntu 9.04 (Jaunty)

Exaile does not call a plugin's disable method on exit. In contrast, it gets called when a plugin is disabled manually in the preferences dialog.

Steps to reproduce:
1. Enable the "Hello World" plugin -> it says hello to standard out
2. Disable the plugin -> it says good bye
3. Enable it again and close Exaile -> the good bye is missing

This functionality is important, for instance to clean up network connections.

Revision history for this message
Adam Olsen (arolsen) wrote :

Fixed in r2327

Changed in exaile:
assignee: nobody → Adam Olsen (arolsen)
importance: Undecided → Medium
milestone: none → 0.3.0
status: New → Fix Committed
Revision history for this message
Oben Sonne (obensonne) wrote :

Works now. That was fast :) Thanks

Revision history for this message
Adam Olsen (arolsen) wrote :

Actually, disable just for when the plugin is disabled.

In r2328, I've added a call to "teardown" for plugins. If your plugin defines a "teardown" function, it will be called when Exaile exits (but only if the plugin is currently enabled).

Revision history for this message
Adam Olsen (arolsen) wrote :

Oh, btw, the signature for this function is the same as enable, and disable

def teardown(exaile):
    # teardown code here

Revision history for this message
reacocard (reacocard) wrote :

Some further clarification on what Adam just said:

Most plugins's disable() calls contain things like removing an element from the GUI, which is a pointless action to take at shutdown time. Therefore, we dont call disable at shutdown, avoiding potential slowness and bugs. There has been for a long time a quit_application event that could be connected to for teardown purposes, and in r2383, Adam moved the same basic function directly into the plugin api with teardown(). However for the reasons outlined above against calling disable(), teardown() should do the bare minimum needed to shut down the plugin cleanly.

tl:dr version: calling disable() for everything is inefficient. use teardown() for things that absolutely must be run at shutdown, and disable() for everything else.

Revision history for this message
Oben Sonne (obensonne) wrote :

All right. This way I'm happy too.

reacocard (reacocard)
Changed in exaile:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.