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-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
* 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

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).