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 662504 - Cannot quit empathy
Cannot quit empathy
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
3.2.x
Other Linux
: High normal
: 3.2
Assigned To: empathy-maint
empathy-maint
: 674260 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-10-23 09:04 UTC by Andrea Corbellini
Modified: 2012-04-20 07:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
empathy: rely on gtk_application_add_window() to manage the main loop (2.23 KB, patch)
2011-10-26 07:30 UTC, Guillaume Desmottes
none Details | Review
empathy: rely on gtk_application_add_window() to manage the main loop (2.23 KB, patch)
2011-10-26 08:27 UTC, Guillaume Desmottes
committed Details | Review
empathy-debugger: rely on gtk_application_add_window() to manage the main loop (991 bytes, patch)
2011-10-26 08:27 UTC, Guillaume Desmottes
committed Details | Review
empathy-accounts: re-use existing TpAccount rather than creating a new one (3.53 KB, patch)
2011-10-26 08:27 UTC, Guillaume Desmottes
committed Details | Review
empathy-accounts: prepare the AM in app_command_line_cb (2.75 KB, patch)
2011-10-26 08:27 UTC, Guillaume Desmottes
committed Details | Review
empathy-debugger: rely on gtk_application_add_window() to manage the main loop (6.64 KB, patch)
2011-10-26 08:27 UTC, Guillaume Desmottes
committed Details | Review
empathy: rely on gtk_application_add_window() to manage the main loop (2.23 KB, patch)
2011-10-26 08:55 UTC, Guillaume Desmottes
committed Details | Review
empathy-accounts: re-use existing TpAccount rather than creating a new one (3.56 KB, patch)
2011-10-26 08:55 UTC, Guillaume Desmottes
committed Details | Review

Description Andrea Corbellini 2011-10-23 09:04:53 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
Comment 1 Guillaume Desmottes 2011-10-24 09:02:31 UTC
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?
Comment 2 Andrea Corbellini 2011-10-24 11:56:29 UTC
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.
Comment 3 Hongzheng Wang 2011-10-25 08:32:41 UTC
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).
Comment 4 Guillaume Desmottes 2011-10-25 14:06:14 UTC
I updated to GLib master and can reproduce this bug now.
Comment 5 Andrea Corbellini 2011-10-25 14:39:45 UTC
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.
Comment 6 Guillaume Desmottes 2011-10-26 07:29:19 UTC
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.
Comment 7 Guillaume Desmottes 2011-10-26 07:30:36 UTC
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.
Comment 8 Guillaume Desmottes 2011-10-26 08:27:38 UTC
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.
Comment 9 Guillaume Desmottes 2011-10-26 08:27:42 UTC
Created attachment 200001 [details] [review]
empathy-debugger: rely on gtk_application_add_window() to manage the main loop
Comment 10 Guillaume Desmottes 2011-10-26 08:27:45 UTC
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.
Comment 11 Guillaume Desmottes 2011-10-26 08:27:49 UTC
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.
Comment 12 Guillaume Desmottes 2011-10-26 08:27:52 UTC
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.
Comment 13 Danielle Madeley 2011-10-26 08:36:23 UTC
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.
Comment 14 Danielle Madeley 2011-10-26 08:38:31 UTC
Review of attachment 200001 [details] [review]:

++
Comment 15 Danielle Madeley 2011-10-26 08:43:32 UTC
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().
Comment 16 Danielle Madeley 2011-10-26 08:45:47 UTC
Review of attachment 200003 [details] [review]:

++
Comment 17 Danielle Madeley 2011-10-26 08:47:35 UTC
Review of attachment 200004 [details] [review]:

++
Comment 18 Guillaume Desmottes 2011-10-26 08:52:46 UTC
Review of attachment 200000 [details] [review]:

::: src/empathy-main-window.c
@@ +1434,3 @@
 			  EmpathyMainWindow *window)
 {
+	gtk_widget_destroy ((GtkWidget *) window);

changed.
Comment 19 Guillaume Desmottes 2011-10-26 08:55:30 UTC
(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.
Comment 20 Guillaume Desmottes 2011-10-26 08:55:42 UTC
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.
Comment 21 Guillaume Desmottes 2011-10-26 08:55:52 UTC
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.
Comment 22 Danielle Madeley 2011-10-26 08:57:18 UTC
Review of attachment 200006 [details] [review]:

++
Comment 23 Danielle Madeley 2011-10-26 08:58:06 UTC
Review of attachment 200007 [details] [review]:

++
Comment 24 Guillaume Desmottes 2011-10-26 09:25:13 UTC
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
Comment 25 Guillaume Desmottes 2011-10-26 09:27:34 UTC
I merged to master and 3.2.
Comment 26 Guillaume Desmottes 2012-04-20 07:38:43 UTC
*** Bug 674260 has been marked as a duplicate of this bug. ***