GNOME Bugzilla – Bug 662504
Cannot quit empathy
Last modified: 2012-04-20 07:38:43 UTC
Empathy cannot be closed neither using the menu (Chat→Quit) or using the keyboard shortcut (Ctrl+Q). Whenever I try to close the application using one of these methods, I get the following output: Gtk-CRITICAL **: gtk_main_quit: assertion `main_loops != NULL' failed
Interesting, I've already been told about this issue but never managed to reproduce it myself. Which distribution, empathy, GTK+ and Glib versions are you using?
I'm using Ubuntu Oneiric. empathy 3.2.0 gtk 3.2.0 glib 2.31.0 (glib does not come from the official repository, but from the GNOME 3 PPA) For your interest, the same problem happens with Gwibber.
I just want to report that I have encountered the same bug. I'm using Debian sid/experimental with empathy 3.2.0, gtk 3.0.12, and glib 2.30.1. In addition, it seems that this bug is related to 659076 (both happened since the upgrade to version 3.1.91).
I updated to GLib master and can reproduce this bug now.
So this bug really affects Empathy itself (not Glib, Gtk or something)? I'm asking this because the same happens with Gwibber and I need to know whether I need to report an another bug or not.
That's because of the way Empathy is interacting with the main loop; I guess Gwibber is doing the same. Let me attach my WIP patch so you'll have a better idea.
Created attachment 199997 [details] [review] empathy: rely on gtk_application_add_window() to manage the main loop We are not supposed to call gtk_main_quit() as we don't use gtk_main() any more. Instead we add the windows to the GtkApplication which will take care of exiting when they have been all destroyed.
Created attachment 200000 [details] [review] empathy: rely on gtk_application_add_window() to manage the main loop We are not supposed to call gtk_main_quit() as we don't use gtk_main() any more. Instead we add the windows to the GtkApplication which will take care of exiting when they have been all destroyed.
Created attachment 200001 [details] [review] empathy-debugger: rely on gtk_application_add_window() to manage the main loop
Created attachment 200002 [details] [review] empathy-accounts: re-use existing TpAccount rather than creating a new one This allows us to detect right away if the account is a valid one and we don't have to prepare it any more as the AM already did it for us.
Created attachment 200003 [details] [review] empathy-accounts: prepare the AM in app_command_line_cb We just need to prepare it in the main instance; there is no point doing it the other ones as they will just re-invoke the main one and exit.
Created attachment 200004 [details] [review] empathy-debugger: rely on gtk_application_add_window() to manage the main loop We have to old the application while doing async preparation as the app window is not created right away.
Review of attachment 200000 [details] [review]: ::: src/empathy-main-window.c @@ +1434,3 @@ EmpathyMainWindow *window) { + gtk_widget_destroy ((GtkWidget *) window); GTK_WIDGET () -- I think we can still fork out for cast macros.
Review of attachment 200001 [details] [review]: ++
Review of attachment 200002 [details] [review]: ::: src/empathy-accounts.c @@ +79,3 @@ + { + if (!tp_strdiff (tp_proxy_get_object_path (l->data), path)) + TpAccount *found = NULL; Couldn't just break here, instead of adding an extra comparison every loop? @@ +121,3 @@ { + empathy_accounts_show_accounts_ui (manager, account, assistant, + G_CALLBACK (gtk_main_quit)); I thought we were meant to stop calling gtk_main_quit().
Review of attachment 200003 [details] [review]: ++
Review of attachment 200004 [details] [review]: ++
Review of attachment 200000 [details] [review]: ::: src/empathy-main-window.c @@ +1434,3 @@ EmpathyMainWindow *window) { + gtk_widget_destroy ((GtkWidget *) window); changed.
(In reply to comment #15) > Review of attachment 200002 [details] [review]: > > ::: src/empathy-accounts.c > @@ +79,3 @@ > + { > + if (!tp_strdiff (tp_proxy_get_object_path (l->data), path)) > + TpAccount *found = NULL; > > Couldn't just break here, instead of adding an extra comparison every loop? Changed. > @@ +121,3 @@ > { > + empathy_accounts_show_accounts_ui (manager, account, assistant, > + G_CALLBACK (gtk_main_quit)); > > I thought we were meant to stop calling gtk_main_quit(). I removed it in a next patch; I just split commits to be more atomics.
Created attachment 200006 [details] [review] empathy: rely on gtk_application_add_window() to manage the main loop We are not supposed to call gtk_main_quit() as we don't use gtk_main() any more. Instead we add the windows to the GtkApplication which will take care of exiting when they have been all destroyed.
Created attachment 200007 [details] [review] empathy-accounts: re-use existing TpAccount rather than creating a new one This allows us to detect right away if the account is a valid one and we don't have to prepare it any more as the AM already did it for us.
Review of attachment 200006 [details] [review]: ++
Review of attachment 200007 [details] [review]: ++
Attachment 200000 [details] pushed as 60de5f6 - empathy: rely on gtk_application_add_window() to manage the main loop Attachment 200001 [details] pushed as 6678cb7 - empathy-debugger: rely on gtk_application_add_window() to manage the main loop Attachment 200002 [details] pushed as 08d8020 - empathy-accounts: re-use existing TpAccount rather than creating a new one Attachment 200003 [details] pushed as cf3a9f5 - empathy-accounts: prepare the AM in app_command_line_cb Attachment 200004 [details] pushed as 6678cb7 - empathy-debugger: rely on gtk_application_add_window() to manage the main loop Attachment 200006 [details] pushed as 60de5f6 - empathy: rely on gtk_application_add_window() to manage the main loop Attachment 200007 [details] pushed as 08d8020 - empathy-accounts: re-use existing TpAccount rather than creating a new one
I merged to master and 3.2.
*** Bug 674260 has been marked as a duplicate of this bug. ***