GNOME Bugzilla – Bug 148126
GKM crashes when right clicking in a keyring row.
Last modified: 2006-11-20 11:29:19 UTC
steps to reproduce: * Open GKM. * Right click in a keyring row in the treeview. It's expected to show a context-menu or to do nothing. * The application crashes. I'll check it out.
I'm not able to duplicate the crash. I've tried right clicking on every treeview in the application, with and without row items. I grabbed a fresh copy from HEAD to test with.
Created attachment 29801 [details] Backtrace of #148126
Claudio, Add some debugging code before line 1082 of gnome-keyring-manager-keyring-manager.c to see if manager->priv->keyring_context_menu is NULL or pointing somewhere it shouldn't. I would print out the memory address that keyring_context_menu pointed two when it was first assigned (in gkm_keyring_manager_init, line 273). From the backtrace it looks like the G_OBJECT () cast is making it crash. If you need me to come up with some debugging code I can make a patch for you.
After several tests, including printing debug info as Caleb pointed out, i think this bug may be GType related, not GKM, as i am using HEAD version of GLib to work on the code. As a last intent I tried adding: g_return_if_fail (GTK_IS_MENU (manager->priv->keyring_context_menu)); in the beginning of the problematic function (see following attached patch) and the crash happens in *that* line.
Created attachment 29907 [details] Test case
Created attachment 32333 [details] [review] Patch for fix against head This may not be proper but it clears in valgrind. Apparently we are using gtk_ui_manager to create our drop down and context menus. We then grab the menu widget from it so we can do some dynamic changes to the context menu. Finally we decrement the reference to our pointer to gtk_ui_manager. This causes the menu widget reference to point to nada. When we later try to access the widget we segfault and the rest is history.
Created attachment 32364 [details] [review] previous fix + utilize ui_manager This replaces manager->priv->keyring_context_menu with manager->priv->ui_manager. Changed the functions to reflect this. unref ui_manager in finalize.
Created attachment 32366 [details] [review] more good stuff Same stuff to gkm-keyring-editor.c and added a Changelog entry.
Thank you very much for the work on this patch. It's now applied
*** Bug 153355 has been marked as a duplicate of this bug. ***
*** Bug 166097 has been marked as a duplicate of this bug. ***
*** Bug 163711 has been marked as a duplicate of this bug. ***
*** Bug 168111 has been marked as a duplicate of this bug. ***
*** Bug 168955 has been marked as a duplicate of this bug. ***
*** Bug 172208 has been marked as a duplicate of this bug. ***
*** Bug 300114 has been marked as a duplicate of this bug. ***
*** Bug 300249 has been marked as a duplicate of this bug. ***
*** Bug 300511 has been marked as a duplicate of this bug. ***
*** Bug 304606 has been marked as a duplicate of this bug. ***
*** Bug 305161 has been marked as a duplicate of this bug. ***
*** Bug 329175 has been marked as a duplicate of this bug. ***
*** Bug 346377 has been marked as a duplicate of this bug. ***
*** Bug 377360 has been marked as a duplicate of this bug. ***