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 77008 - crash on exit (possibly related to XIM)
crash on exit (possibly related to XIM)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other other
: High critical
: ---
Assigned To: Federico Mena Quintero
gedit QA volunteers
: 83226 88940 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-03-30 21:52 UTC by kz
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch with proposed fix (2.91 KB, patch)
2002-05-17 01:08 UTC, Federico Mena Quintero
none Details | Review
Updated patch. (6.65 KB, patch)
2002-05-17 17:41 UTC, Federico Mena Quintero
none Details | Review

Description kz 2002-03-30 21:53:28 UTC
Package: gedit
Severity: normal
Version: 1.116.0
Synopsis: crash on exit
Bugzilla-Product: gedit
Bugzilla-Component: general
BugBuddy-GnomeVersion: 2.0 (1.113.0)

Description:
whenever I quit gedit, crash.
I'm sorry but I have nothing more to tell about this issue.



Debugging Information:

Backtrace was generated from '/usr/bin/gedit'

[New Thread 1024 (LWP 26910)]
0x40c3aca9 in __wait4 () from /lib/i686/libc.so.6

Thread 1 (Thread 1024 (LWP 26910))

  • #0 __wait4
    from /lib/i686/libc.so.6
  • #1 __DTOR_END__
    from /lib/i686/libc.so.6
  • #2 waitpid
    at wrapsyscall.c line 172
  • #3 libgnomeui_segv_handle
    at gnome-ui-init.c line 593
  • #4 pthread_sighandler
    at signals.c line 97
  • #5 <signal handler called>
  • #6 ??
  • #7 g_closure_invoke
    at gclosure.c line 437
  • #8 signal_emit_unlocked_R
    at gsignal.c line 2341
  • #9 g_signal_emit_valist
    at gsignal.c line 2100
  • #10 gtk_signal_emit
    at gtksignal.c line 355
  • #11 gtk_object_dispose
    at gtkobject.c line 373
  • #12 gtk_widget_dispose
    at gtkwidget.c line 5599
  • #13 gtk_window_dispose
    at gtkwindow.c line 1546
  • #14 bonobo_window_dispose
    at bonobo-window.c line 154
  • #15 g_object_run_dispose
    at gobject.c line 469
  • #16 gtk_object_destroy
    at gtkobject.c line 358
  • #17 gtk_widget_destroy
    at gtkwidget.c line 1581
  • #18 app_close_book
    at bonobo-mdi.c line 965
  • #19 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 82
  • #20 g_closure_invoke
    at gclosure.c line 437
  • #21 signal_emit_unlocked_R
    at gsignal.c line 2341
  • #22 g_signal_emit_valist
    at gsignal.c line 2110
  • #23 gtk_signal_emit
    at gtksignal.c line 355
  • #24 gtk_widget_event_internal
    at gtkwidget.c line 3076
  • #25 gtk_main_do_event
    at gtkmain.c line 1252
  • #26 gdk_event_dispatch
    at gdkevents-x11.c line 1752
  • #27 g_main_dispatch
    at gmain.c line 1617
  • #28 g_main_context_dispatch
    at gmain.c line 2161
  • #29 g_main_context_iterate
    at gmain.c line 2242
  • #30 g_main_loop_run
    at gmain.c line 2462
  • #31 gtk_main
    at gtkmain.c line 916
  • #32 main
    at gedit2.c line 198
  • #33 __libc_start_main
    at ../sysdeps/generic/libc-start.c line 129
  • #0 __wait4
    from /lib/i686/libc.so.6
  • #0 __wait4
    from /lib/i686/libc.so.6
  • #1 __DTOR_END__
    from /lib/i686/libc.so.6
  • #2 waitpid
    at wrapsyscall.c line 172
  • #3 libgnomeui_segv_handle
    at gnome-ui-init.c line 593
  • #4 pthread_sighandler
    at signals.c line 97
  • #5 <signal handler called>
  • #6 ??
  • #7 g_closure_invoke
    at gclosure.c line 437




------- Bug moved to this database by unknown@bugzilla.gnome.org 2002-03-30 16:53 -------

Reassigning to the default owner of the component, maggi@athena.polito.it.

Comment 1 James Willcox 2002-03-31 21:00:06 UTC
I can't reproduce this.  How new is your gtk+, libbonoboui, etc?  If
there are more than a couple weeks old, try upgrading them and see if
the problem persists.
Comment 2 kz 2002-03-31 21:20:49 UTC
I use ximian 200203290257 snapshot.
I suspect xim is guilty for this problem. what about it?
Comment 3 Luis Villa 2002-04-01 16:08:10 UTC
Is this trace of any use, Paolo?
Comment 4 Paolo Maggi 2002-04-10 13:31:22 UTC
I really don't know how to reproduce it.

Do you have the same problem with other gnome2 apps (es. EOG)?

From the trace, it seems to crash while destroying a BonoboWindow.

Could you give me some info on XIM?
Comment 5 Paolo Maggi 2002-04-17 14:15:50 UTC
The bt is not so usefull to me.

Keizi: could you please try to turn off XIM and try to reproduce it?
Comment 6 kz 2002-04-17 18:30:37 UTC
1. killall ami(=xim application)
2. gedit
3. quit
---> clear!

xim is guilty.
Comment 7 Luis Villa 2002-04-18 03:52:45 UTC
So is this a XIM bug (and hence this should be closed) or is XIM doing
the write thing and gedit behaving poorly? I know exactly zilch about
how XIM works so I can't say.
Comment 8 Paolo Maggi 2002-04-20 14:51:51 UTC
Could you please test gtk-demo and/or testtext (in gtk+)?
Do they work with XIM?

I'm trying to understand if this is a gtk+ bug or a gedit one.
Note that I know nothing about XIM.
Comment 9 kz 2002-04-22 16:36:48 UTC
gtk-demo->Text Widget and testtext not crash after common message:
"""
GLib-GObject-Message: finalizing base class of GtkIMContextXIM
"""
while gedit does open crash dialog.

(I ensure that I've installed latest cvs of gtk+)
Comment 10 Paolo Maggi 2002-04-22 17:02:28 UTC
Could you please test also eog?
It should use libbonoboui (like gedit).
Comment 11 kz 2002-04-22 17:25:42 UTC
eh, I think I tested eog and get crash. but now eog not open crash.
and also do not flush XIM finalizing message.
Comment 12 Federico Mena Quintero 2002-04-30 18:15:49 UTC
How would I start or use an input method to test this?
Comment 13 kz 2002-04-30 23:03:04 UTC
for hangul,
1. export LANG=ko_KR.eucKR (or just ko, or korean. I cannot sure which
one supported in your system)
2. ami &, then ami launched in minimized window.
3. gedit
4. <Shift>Space may change XIM status into Korean. (in fact this step
is not necessary.)
5. quit the gedit. and crash dialog pop.
Comment 14 Paolo Maggi 2002-05-02 13:30:06 UTC
I have not ami installed on my system (RedHat 7.2).

Where can I find it?
Comment 15 kz 2002-05-02 14:22:18 UTC
rh72 have ami package in. I think you can install it, like Owen 
succeed. :)
Comment 16 Federico Mena Quintero 2002-05-15 22:15:22 UTC
I installed ami and followed your instructions.  However, pressing
shift+space did not seem to do anything.

However, when I click the right mouse button on the text area and try
to change the input method, it just displays "Default" with no other
input methods.

Do you have any ideas on why this may be happening?  Am I missing an
environment variable or something?
Comment 17 kz 2002-05-15 22:26:30 UTC
you may need to do:
    $ gtk-query-immodules-2.0 > ~/.gtk.immodules
and
    $ cat >> ~/.gtkrc-2.0
    im_module_file "/home/Keizi/.gtk.immodules"
    ^D

or just:
    # gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
Comment 18 Federico Mena Quintero 2002-05-16 03:25:40 UTC
Thanks!  I just reinstalled GTK+ from source (I was using the Ximian
snapshots) and it works now.

I can duplicate the crash.  Something is smashing the stack big time
when you close the window or try to exit the application.
Comment 19 Federico Mena Quintero 2002-05-16 19:09:58 UTC
Ignore the smashed stack bit.

The problem happens because:

1. The GTK+ im-xim.so module gets loaded.

2. It connects to some signals of the toplevel GEdit window, and the
callbacks are of course in the dynamic module.

3. The module gets unloaded when you change input methods, but it
never disconnects from the signals.

4. So when you destroy the GEdit window, the signal invokes the
callback which no longer is in memory, and crashes.
Comment 20 Federico Mena Quintero 2002-05-16 19:17:36 UTC
To duplicate the bug, it is not necessary to have AMI running or
anything.  Simply do this:

1. export LANG=ko_KR.eucKR

2. run GEdit

3. Right-click on the text area.  On the context menu, switch to the
Hangul input method.  This causes the default X input method to be
unloaded and the Hangul to be loaded.

4. Close the GEdit window.  Crash.

CCing the GTK+ people.
Comment 21 Federico Mena Quintero 2002-05-16 22:26:59 UTC
GTK+ bug, so changing the product.
Comment 22 Luis Villa 2002-05-16 22:53:10 UTC
Are you going to provide a fix for gtk, Federico? If not, please
reassign to 'owner of selected component'. Thanks.
Comment 23 Federico Mena Quintero 2002-05-17 01:07:41 UTC
Attaching patch, tested to work.  This is the ChangeLog entry:

2002-05-16  Federico Mena Quintero  <federico@ximian.com>

	Fixes #77008.

	* modules/input/gtkimcontextxim.h (struct _GtkIMContextXIM): Added
	a status_windows field to hold all the status windows that we
	create.

	* modules/input/gtkimcontextxim.c (gtk_im_context_xim_init):
	Initialize the status_windows field.
	(status_window_get): Set the "gtk-im-xim-toplevel" data on the
	status_window so that we can identify its toplevel window later.
	Set the "gtk-im-xim-context" data on it as well so that we can
	fetch its corresponding context.  Also, add it to the list of
	status windows for this context.
	(gtk_im_context_xim_finalize): Destroy the list of status windows
	while disconnecting them from their respective toplevels' signals.
	(status_window_destroy): Remove the status window from the list in
	its context.
Comment 24 Federico Mena Quintero 2002-05-17 01:08:11 UTC
Created attachment 8528 [details] [review]
Patch with proposed fix
Comment 25 Federico Mena Quintero 2002-05-17 01:11:43 UTC
Ignore the "#include <stdio.h>" bit in the patch; it is a leftover
from debugging printf()s.
Comment 26 Owen Taylor 2002-05-17 03:07:08 UTC
a) There are typically many input contexts for a single
   toplevle, all of which share a single status window;
   so it does need to be done when the module is unloaded.

+      g_signal_handlers_disconnect_matched (toplevel,
+
				    G_SIGNAL_MATCH_DATA,
+
				    0, 0, NULL, NULL,
+
				    status_window);
+      g_object_set_data (G_OBJECT (toplevel), 

b) Never disconnect/connect by data alone; call 
   g_signal_handlers_disconnect_by_func() however many
   times are neccessary.Disconnecting by data is 
   considered by bad idea since you really don't have
   control over whether someone else is using that
   data in most cases.

   That's why there is no g_signal_handlers_disconnect_by_data()
Comment 27 Federico Mena Quintero 2002-05-17 17:41:41 UTC
Created attachment 8542 [details] [review]
Updated patch.
Comment 28 Federico Mena Quintero 2002-05-17 17:42:35 UTC
Re-CCing gtk-bugs; new patch has been attached.
Comment 29 Owen Taylor 2002-05-17 19:34:47 UTC
  status_window = g_object_get_data (G_OBJECT (toplevel),
"gtk-im-xim-status\-window");
  if (status_window || !create)
    return status_window->window;

!

Made that and a few other fixes, simplified a bit, reindented
and comitted.

Fri May 17 14:40:24 2002  Owen Taylor  <otaylor@redhat.com>

	* modules/input/gtkimcontextxim.c (status_window_free): 
	Patch from Federico Mena Quintero to fix problem where
	references to IMContextXIM were kept around after
	module was unloaded. (#77008)
Comment 30 Federico Mena Quintero 2002-05-17 20:01:39 UTC
Great!  Thanks, Owen!
Comment 31 Federico Mena Quintero 2002-05-28 18:03:16 UTC
*** Bug 83226 has been marked as a duplicate of this bug. ***
Comment 32 Owen Taylor 2002-07-29 19:55:19 UTC
*** Bug 88940 has been marked as a duplicate of this bug. ***