public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* libglib2, Emacs and GTK applications
@ 2010-02-08 14:31 Angelo Graziosi
  2010-02-09  3:04 ` Yaakov (Cygwin/X)
  0 siblings, 1 reply; 5+ messages in thread
From: Angelo Graziosi @ 2010-02-08 14:31 UTC (permalink / raw)
  To: XCygwin

Just for completeness, I want to flag some strange things that I see 
between a GTK build of Emacs and libglib2.0_0-2.22.4-2 BUT NOT with 
libglib2.0_0-2.22.4-1!

With 2.22.4-2, when I open a dialog box (for example clicking on the 
tool bar icon "Reading an existing file into an Emacs buffer"), in /tmp 
is created the directory 'fam-angelo' and 'ps' shows a 'gamin-server' 
running. When I quit from Emacs (C-x C-c), the Emacs window stays on the 
desktop until 'gamin-server' is removed, i.e. for at least 20-30 
seconds, looking as if Emacs were hanging.

This behavior does not happens with version 2.22.4-1. The 
'/tmp/fam-angelo' directory is not created and 'gamin-server' or is not 
started or it is removed immediately when it does not need any more. 
Also the 'apparent' hanging disappears.

The above facts should be verified also with the following test case of 
GTK application I found in this list. It should be build with:

gcc -DTRY1 -Wall -o test-dialog3-try1-01 test-dialog3.c `pkg-config 
--cflags --libs gtk+-2.0


Then

$ ./test-dialog3-try1-01.exe

under libglib2-2.22.4-2 creates /tmp/fam-angelo and starts 
'gamin-server' which is removed only after 20-30 seconds. With 2.22.4-1, 
it is removed imediately (or does not start at all!).

Ciao,
Angelo.


test-dialog3.c
============================================
#include <gtk/gtk.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
/* When testing the FAM daemon*/
#ifdef TRY2
#include <fam.h>
#endif

int main( int   argc,
           char *argv[] )
{

   GtkWidget *main_window;
   GtkWidget *button;

   gtk_init (&argc, &argv);
   main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   button = gtk_button_new_with_label ("Show");

   /*  Commenting either of the 3 lines below allows it to work. */
   gtk_container_add (GTK_CONTAINER (main_window), button);
   gtk_widget_show (button);
   gtk_widget_show (main_window);

#ifdef TRY1
   {
     GtkWidget *dialog;
     printf("Using gtk_file_chooser_dialog_new.\n");
     dialog = gtk_file_chooser_dialog_new ("Open File",
       NULL,
       GTK_FILE_CHOOSER_ACTION_OPEN,
       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
       GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
       NULL);
   }
#else
#ifdef TRY2
   /* The code below is called from _fam_sub_startup in glib2 */
   {
     FAMConnection fc;
     printf("Using FAMOpen2.\n");
     if (FAMOpen2 (&fc, "gvfs user") != 0)  {
       printf ("FAMOpen failed, FAMErrno=%d\n", FAMErrno);
       printf ("FAM Error Message: %s\n",FamErrlist[FAMErrno]);
     } else {
       FAMClose(&fc);
     }
   }
#else
   /* The code below is called from gamin_fork_server in gamin*/
   {
     int ret, pid, status;
     printf("Using fork twice in a row.\n");
     pid = fork();
     if (pid == 0) {
       printf("First fork.\n");
       if (fork() == 0) {
	printf("Second fork.\n");
	execl("/usr/bin/ls.exe", "/usr/bin/ls.exe", NULL);
       }
       /*
        * calling exit() generate troubles for termination handlers
        * for example if the client uses bonobo/ORBit
        */
       _exit(0);
     }
     /*
      * do a waitpid on the intermediate process to avoid zombies.
      */
   retry_wait:
     ret = waitpid(pid, &status, 0);
     if (ret < 0) {
       if (errno == EINTR)
	goto retry_wait;
     }
   }
#endif
#endif
   printf("Done.\n");
#if defined (TRY1) || defined (TRY2)
   printf("Please make sure the FAM daemon is not running "
	 "before testing again.\n");
   printf("(i.e. kill the gam_server process or wait until it is gone)\n");
#endif
   return 0;
}
============================================

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libglib2, Emacs and GTK applications
  2010-02-08 14:31 libglib2, Emacs and GTK applications Angelo Graziosi
@ 2010-02-09  3:04 ` Yaakov (Cygwin/X)
  0 siblings, 0 replies; 5+ messages in thread
From: Yaakov (Cygwin/X) @ 2010-02-09  3:04 UTC (permalink / raw)
  To: cygwin-xfree

On 08/02/2010 08:30, Angelo Graziosi wrote:
> Just for completeness, I want to flag some strange things that I see
> between a GTK build of Emacs and libglib2.0_0-2.22.4-2 BUT NOT with
> libglib2.0_0-2.22.4-1!

Let me start with this intro: 2.22.4-1 included a fix for GIO plugin 
loading on Win32[1], but once again they lumped Cygwin together with 
MinGW.  Of course, not only did this not need to be "fixed" on Cygwin 
but they outright broke GIO and everything that depends on it, and I got 
to pick up the pieces.  Hence the need for 2.22.4-2, which behaves as it 
should.

So you might as well forget about 2.22.4-1, and focus on whatever issues 
you appear to be having with GIO.

[1] http://git.gnome.org/browse/glib/commit/?h=glib-2-22&id=ae0a220b

> With 2.22.4-2, when I open a dialog box (for example clicking on the
> tool bar icon "Reading an existing file into an Emacs buffer"), in /tmp
> is created the directory 'fam-angelo' and 'ps' shows a 'gamin-server'
> running.

This is the expected behaviour.  GtkFileChooser uses GFileMonitor (whose 
backend uses FAM/Gamin) so that changes to the directory being browsed 
are displayed.

> When I quit from Emacs (C-x C-c), the Emacs window stays on the
> desktop until 'gamin-server' is removed, i.e. for at least 20-30
> seconds, looking as if Emacs were hanging.

I haven't seen this behaviour with other GTK+ apps, so I suspect it may 
be (YA) emacs/gtk+ bug.  (Googling shows that this seems to happen a 
lot.)  You may want to try these patches and see if they help:

http://patch-tracker.debian.org/patch/series/dl/emacs23/23.1+1-6/fix-dynamic-menus.diff
http://patch-tracker.debian.org/patch/series/dl/emacs23/23.1+1-6/fix-gtk-scroll-bar-events.diff


Yaakov
Cygwin/X

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libglib2, Emacs and GTK applications
@ 2010-02-09 12:38 Angelo Graziosi
  0 siblings, 0 replies; 5+ messages in thread
From: Angelo Graziosi @ 2010-02-09 12:38 UTC (permalink / raw)
  To: XCygwin

Yaakov (Cygwin/X) wrote:
> 1) rebaseall, as launching gam_server involves a fork(), the failure of which can lead to strange behaviour.

Hmm...
At the moment my installation is quite stable and I won't rebase without 
being sure that it really needs a rebase. After all, with Emacs I rarely 
use dialog box: C-x C-f, etc., are faster to work with...

I have to think a little more before rebasing... :-)

> 2) create a ~/.gaminrc with the following contents:
>
> fsset ntfs poll 10

It does not works, sigh! :(

In any case, thanks for all your suggestions.

Ciao,
Angelo.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libglib2, Emacs and GTK applications
  2010-02-09  9:05 Angelo Graziosi
@ 2010-02-09  9:39 ` Yaakov (Cygwin/X)
  0 siblings, 0 replies; 5+ messages in thread
From: Yaakov (Cygwin/X) @ 2010-02-09  9:39 UTC (permalink / raw)
  To: cygwin-xfree

On 09/02/2010 03:05, Angelo Graziosi wrote:
> The problems seem to be consequence of the fact that 'gamin-server.exe'
> is not removed after application finishes, but only after 20-30 seconds
> and I see this behavior also with the test case reported.

I run GTK+/GNOME apps all the time, and I have yet to see this, so 
AFAICS it's not a bug in gamin or GLib/GTK+.  The only other things I 
can suggest are:

1) rebaseall, as launching gam_server involves a fork(), the failure of 
which can lead to strange behaviour.

2) create a ~/.gaminrc with the following contents:

fsset ntfs poll 10

The last number is the poll interval, in seconds.  The default is every 
second, and that can sometimes lead to excessive CPU usage.  Usually 
that's only a problem with KDE, where several large parts of /usr/share 
are monitored, but it's worth trying.


Yaakov
Cygwin/X

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libglib2, Emacs and GTK applications
@ 2010-02-09  9:05 Angelo Graziosi
  2010-02-09  9:39 ` Yaakov (Cygwin/X)
  0 siblings, 1 reply; 5+ messages in thread
From: Angelo Graziosi @ 2010-02-09  9:05 UTC (permalink / raw)
  To: XCygwin

Yaakov (Cygwin/X) wrote:
> You may want to try these patches and see if they help:

My build of Emacs was related to current trunk (precisely, rev. 99467), 
so, almost surely, those patches are already applied (indeed, I find 
tracks of them in the current code).

The problems seem to be consequence of the fact that 'gamin-server.exe' 
is not removed after application finishes, but only after 20-30 seconds 
and I see this behavior also with the test case reported.

However, thanks a lot for your clarifications and for having followed this.

Ciao,
Angelo.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-09 12:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-08 14:31 libglib2, Emacs and GTK applications Angelo Graziosi
2010-02-09  3:04 ` Yaakov (Cygwin/X)
2010-02-09  9:05 Angelo Graziosi
2010-02-09  9:39 ` Yaakov (Cygwin/X)
2010-02-09 12:38 Angelo Graziosi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).