GNOME Bugzilla – Bug 708286
GtkBuilder related memory leak fixes and cleanups
Last modified: 2013-10-01 08:09:13 UTC
I was investigating a crash when toggling a switch on the a11y panel for 2nd time after having opened the panel, closing and returning back to it. The crash happens in a GSettings changed signal handler because the GSettings instance isn't finalized when exiting the panel since it is bound to a widget which happens to be a child of a GtkDialog. It turns out that toplevel windows instantiated by GtkBuilder actually have a reference count of 2 and thus aren't destroyed along with the GtkBuilder instance. The documentation actually says so: "Toplevel windows returned by these functions will stay around until the user explicitly destroys them with gtk_widget_destroy()." Then I checked other panels and yes, most of them are leaking GtkDialog instances and other toplevels which are never used. This patch set tries to fix this. AFAIK only the a11y panel case actually leads to a crash but I didn't investigate each case closely enough to be sure.
Created attachment 255176 [details] [review] bluetooth: Remove dead code
Created attachment 255177 [details] [review] bluetooth: Remove unused toplevel window from .ui file
Created attachment 255178 [details] [review] color: Remove a duplicate widget instance
Created attachment 255179 [details] [review] color: Don't leak the calibrate dialog
Created attachment 255180 [details] [review] color: Don't leak the calibrate builder instance
Created attachment 255181 [details] [review] color: Remove unused toplevel window from .ui file
Created attachment 255182 [details] [review] color: Remove an unused dialog
Created attachment 255183 [details] [review] color: Don't leak the calibration assistant dialog
Created attachment 255184 [details] [review] color: Don't leak the assign dialog
Created attachment 255185 [details] [review] datetime: Don't leak the dialogs
Created attachment 255186 [details] [review] datetime: Remove unused toplevel window from .ui file
Created attachment 255187 [details] [review] display: Remove no longer used .ui file
Created attachment 255188 [details] [review] info: Don't leak a dialog
Created attachment 255189 [details] [review] info: Remove unused toplevel window from .ui file
Created attachment 255190 [details] [review] keyboard: Remove unused toplevel window from .ui file
Created attachment 255191 [details] [review] keyboard: Don't leak a dialog
Created attachment 255192 [details] [review] mouse: Remove unused variable
Created attachment 255193 [details] [review] mouse: Remove unused toplevel windows from .ui files
Created attachment 255194 [details] [review] network: Remove unused toplevel windows from .ui files
Created attachment 255195 [details] [review] network: Don't leak a couple of dialogs
Created attachment 255196 [details] [review] network: Don't leak a builder instance
Created attachment 255197 [details] [review] network: Remove an unused dialog
Created attachment 255198 [details] [review] notifications: Remove unused toplevel window from .ui file
Created attachment 255199 [details] [review] online-accounts: Remove unused toplevel window from .ui file
Created attachment 255200 [details] [review] power: Don't leak a dialog
Created attachment 255201 [details] [review] power: Remove unused toplevel window from .ui file
Created attachment 255202 [details] [review] printers: Don't leak a couple of dialogs
Created attachment 255203 [details] [review] privacy: Don't leak the dialogs
Created attachment 255204 [details] [review] privacy: Remove unused toplevel window from .ui file
Created attachment 255205 [details] [review] region: Remove unused toplevel window from .ui file
Created attachment 255206 [details] [review] search: Remove unused toplevel window from .ui file
Created attachment 255207 [details] [review] sharing: Remove unused toplevel window from .ui file
Created attachment 255208 [details] [review] user-accounts: Don't leak a dialog
Created attachment 255209 [details] [review] user-accounts: Remove no longer used .ui file
Created attachment 255210 [details] [review] user-accounts: Remove unused toplevel window from .ui file
Created attachment 255211 [details] [review] universal-access: Remove unused toplevel window from .ui file
Created attachment 255213 [details] [review] universal-access: Don't leak the dialogs
Review of attachment 255176 [details] [review]: ++
Review of attachment 255177 [details] [review]: ++
Review of attachment 255178 [details] [review]: ++
Review of attachment 255179 [details] [review]: ++
Review of attachment 255180 [details] [review]: ++
Review of attachment 255181 [details] [review]: ++
Review of attachment 255182 [details] [review]: ++
Review of attachment 255183 [details] [review]: ++
Review of attachment 255184 [details] [review]: ++
Review of attachment 255185 [details] [review]: ++
Review of attachment 255186 [details] [review]: ++
Review of attachment 255187 [details] [review]: ++
Review of attachment 255188 [details] [review]: ++
Review of attachment 255189 [details] [review]: ++
Review of attachment 255190 [details] [review]: ++
Review of attachment 255191 [details] [review]: ++
Review of attachment 255192 [details] [review]: ++
Review of attachment 255193 [details] [review]: ++
Review of attachment 255194 [details] [review]: ++
Review of attachment 255195 [details] [review]: ++
Review of attachment 255196 [details] [review]: ++
Review of attachment 255197 [details] [review]: ++
Review of attachment 255198 [details] [review]: ++
Review of attachment 255199 [details] [review]: ++
Review of attachment 255200 [details] [review]: ++
Review of attachment 255201 [details] [review]: ++
Review of attachment 255202 [details] [review]: ++
Review of attachment 255203 [details] [review]: ++
Review of attachment 255204 [details] [review]: ++
Review of attachment 255205 [details] [review]: ++
Review of attachment 255206 [details] [review]: ++
Review of attachment 255207 [details] [review]: ++
Review of attachment 255208 [details] [review]: ++
Review of attachment 255209 [details] [review]: ++
Review of attachment 255210 [details] [review]: ++
Review of attachment 255211 [details] [review]: ++
Review of attachment 255213 [details] [review]: ++
Attachment 255176 [details] pushed as be3965a - bluetooth: Remove dead code Attachment 255177 [details] pushed as 37b31be - bluetooth: Remove unused toplevel window from .ui file Attachment 255178 [details] pushed as 7542385 - color: Remove a duplicate widget instance Attachment 255179 [details] pushed as 62faba9 - color: Don't leak the calibrate dialog Attachment 255180 [details] pushed as bd978ea - color: Don't leak the calibrate builder instance Attachment 255181 [details] pushed as 73a7f4c - color: Remove unused toplevel window from .ui file Attachment 255182 [details] pushed as 5e0d626 - color: Remove an unused dialog Attachment 255183 [details] pushed as 1776558 - color: Don't leak the calibration assistant dialog Attachment 255184 [details] pushed as 418b9f9 - color: Don't leak the assign dialog Attachment 255185 [details] pushed as 545c886 - datetime: Don't leak the dialogs Attachment 255186 [details] pushed as a401a91 - datetime: Remove unused toplevel window from .ui file Attachment 255187 [details] pushed as ea4f2b1 - display: Remove no longer used .ui file Attachment 255188 [details] pushed as 416de8a - info: Don't leak a dialog Attachment 255189 [details] pushed as ae19832 - info: Remove unused toplevel window from .ui file Attachment 255190 [details] pushed as 640cdb4 - keyboard: Remove unused toplevel window from .ui file Attachment 255191 [details] pushed as f444c7b - keyboard: Don't leak a dialog Attachment 255192 [details] pushed as 98719f3 - mouse: Remove unused variable Attachment 255193 [details] pushed as 98ec15a - mouse: Remove unused toplevel windows from .ui files Attachment 255194 [details] pushed as c5b70a7 - network: Remove unused toplevel windows from .ui files Attachment 255195 [details] pushed as db62c4f - network: Don't leak a couple of dialogs Attachment 255196 [details] pushed as 2d18798 - network: Don't leak a builder instance Attachment 255197 [details] pushed as e0583d0 - network: Remove an unused dialog Attachment 255198 [details] pushed as f83c661 - notifications: Remove unused toplevel window from .ui file Attachment 255199 [details] pushed as 9288bbb - online-accounts: Remove unused toplevel window from .ui file Attachment 255200 [details] pushed as 4494045 - power: Don't leak a dialog Attachment 255201 [details] pushed as 7c58167 - power: Remove unused toplevel window from .ui file Attachment 255202 [details] pushed as b17bd4e - printers: Don't leak a couple of dialogs Attachment 255203 [details] pushed as 33202b9 - privacy: Don't leak the dialogs Attachment 255204 [details] pushed as d9196b8 - privacy: Remove unused toplevel window from .ui file Attachment 255205 [details] pushed as 559161b - region: Remove unused toplevel window from .ui file Attachment 255206 [details] pushed as 96b9111 - search: Remove unused toplevel window from .ui file Attachment 255207 [details] pushed as fcb5401 - sharing: Remove unused toplevel window from .ui file Attachment 255208 [details] pushed as 3b485b6 - user-accounts: Don't leak a dialog Attachment 255209 [details] pushed as d8620d3 - user-accounts: Remove no longer used .ui file Attachment 255210 [details] pushed as 4001cbf - user-accounts: Remove unused toplevel window from .ui file Attachment 255211 [details] pushed as 926615b - universal-access: Remove unused toplevel window from .ui file Attachment 255213 [details] pushed as e7de1af - universal-access: Don't leak the dialogs