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 609454 - Style for <delegate>.destroy() methods
Style for <delegate>.destroy() methods
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-02-09 19:30 UTC by Owen Taylor
Modified: 2010-02-20 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use _onDestroy() handlers for cleanup in delegates (4.09 KB, patch)
2010-02-18 16:24 UTC, Florian Müllner
committed Details | Review

Description Owen Taylor 2010-02-09 19:30:48 UTC
<owen> Do we have a style for whether delegate's destroy() methods should just be this.actor.destroy() and be combined with a signal connection to destroy, or whether it's OK to do cleanups in the delegate destroy method?
<danw> i would have said that we do have a style, and it's the former
<walters> i don't think we have a consistent style but i much prefer the former
---

Possible violations of the style:

 lightbox.js:Lightbox.destroy
 
   This is actually a signal handler and should be called _onDestroy rather than destroy().

 workspace.js:Workspace.destroy
 workspacesView.js:GenericWorkspacesView.destroy

   These methods do a lot of stuff; there might be some subtle reasons that the guts can't be moved to an _onDestroy(), but not obviously.

sidebar.js:Sidebar.destroy
widgetBox.js:WidgetBox.destroy
widget.js:ClockWidget.destroy

   Intent might be to have the widgets destroyed before the actor hierarchy. This is a little outside or normal scope.

As well as fixing up LightBox/Workspace/GenericWorkspace, the other thing to close this bug would be adding a note about this to http://live.gnome.org/GnomeShell/StyleGuide.
Comment 1 Florian Müllner 2010-02-18 16:24:51 UTC
Created attachment 154148 [details] [review]
Use _onDestroy() handlers for cleanup in delegates

Unify the style of <delegate>.destroy() methods to only contain a
call to <delegate>.actor.destroy() and handle additional cleanup
in a _onDestroy() signal handler.
Comment 2 Owen Taylor 2010-02-18 20:35:28 UTC
Review of attachment 154148 [details] [review]:

Looks reasonable to me. Note my note about StyleGuide before closing the bug.
Comment 3 Florian Müllner 2010-02-18 21:42:23 UTC
Comment on attachment 154148 [details] [review]
Use _onDestroy() handlers for cleanup in delegates

Attachment 154148 [details] pushed as 9f43ed3 - Use _onDestroy() handlers for cleanup in delegates

Not closing because of the missing addition to the style guide.
Comment 4 Dan Winship 2010-02-20 17:05:52 UTC
updated style guide