Subject: FvwmButton not releasing swallows

From: Brad Giaccio <[email-masked]>
Date: Thu, 1 Oct 1998 13:45:17 -0400 (EDT)

I really don't have any idea where to begin in the code but has anyone
else noticed that if swallowed windows with the NoKill option don't get
remapped when FvwmButtons goes away.  I'm running 2.0.47d with only the
destroy menu patch.  And the problem is in the Buttons Module.  Anyone
else seeing this. And yes it did work with 2.046, and if I swap binaries
and run the old module in 2.0.47 it works.

here is my buttons config.
Brad

----
##################### button-bar ################################
Geometry -1+1
Columns 1
Rows 10
Fore rgb:51/51/78
Back rgb:51/51/78

(Swallow(NoClose,UseOld) "xdaliclock" `Exec xdaliclock -noshape -geometry 120x30 &`,Size 120 30)

(1x4,Container (Columns 2, Rows 1))
(1x1,Swallow(Kill) "xbuffy" `Exec xrsh boyce xbuffy -fg ivory -bg rgb:51/51/78 &`,Size 60 120)    
(Swallow(NoClose,UseOld) "FvwmPager" `Module FvwmPager 0 0`,Size 50 120 )                
(End)

(Container (Columns 2, Rows 1))
(Swallow(Kill) "xbiff++" `Exec xbiff++ -update 20`,Size 30 30)
(2x1,Swallow(NoClose,UseOld) "xload" `Exec xload -bg rgb:51/51/78 -fg red -hl blue -update 1 &`,Size 60 30 )
(End)

(Container (Columns 1, Rows 2))
(Swallow(NoClose,UseOld) "xcpu boyce" `Exec rxcpu.sh boyce &`,Size 120 15)
(Swallow(NoClose,UseOld) "xcpu colt" `Exec xrsh colt rxcpu.sh colt &`,Size 120 15 )
(End)
(Swallow(NoClose,UseOld) "xcpu pitcairn" `Exec xrsh pitcairn.psrw.com rxcpu.sh pitcairn & >/dev/null`,Size 120 30 )
(Swallow(NoClose,UseOld) "xcpu humbolt" `Exec xrsh humbolt rxcpu.sh humbolt &`,Size 120 30 )
(Swallow(NoClose,UseOld) "xcpu jojo" `Exec xrsh jojo rxcpu.sh jojo &`,Size 120 30 )

-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 08 Oct 1998 13:13:53 +0200

Hi Brad,

> I really don't have any idea where to begin in the
> code but has anyone else noticed that if swallowed
> windows with the NoKill option don't get remapped
> when FvwmButtons goes away.

You mean NoClose.

> Anyone else seeing this.

Yes, I do. But it is not exactly as you describe. No
swallowed windows are killed or closed at all, but
they are not remapped either. The reason is simple:
Someone has put an '#if 0' around the responsible
signal handler (DeadPipe function in FvwmButtons.c).
There is a comment that explains (?) why:

  can't do all this in a signal handler, so just exit

Obviously this is an unfinished fix the reason of
which is a complete mystery to me. A patch to fix
this follows.
 
Ciao

Dominik

--- FvwmButtons.c.orig  Tue Jun 23 21:58:30 1998
+++ FvwmButtons.c       Wed Oct  7 23:36:43 199^M
@@ -181,7 +181,6 @@
 **/
 void DeadPipe(int whatever)
 {
-#if 0 /* can't do all this in a signal handler, so just
exit */
   button_info *b,*ub=UberButton;
   int button=-1;

@@ -248,7 +247,7 @@
         && !(b->c->flags&b_TransBack))
        DestroyPicture(Dpy,b->c->backicon);
     }
-#endif /* 0 */
+
 }

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883,
[email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Tim Phipps <[email-masked]>
Date: Thu, 08 Oct 1998 12:45:31 +0100

> which is a complete mystery to me. A patch to fix

I seem to remember that several of the modules would go into an endless
loop if the X server died.  There was a set of patches to 2.0.46 that
fixed it and I think this is it.  The signal handler is called when any
of the I/O streams fails.  It could be improved to check if it's the X
server connection that has gone or the pipes to FVWM.  If the X server
has gone the correct thing to do is exit, if it hasn't then the original
clean up should happen before it exits.  You're not supposed to call any
functions in a signal handler unless the things you are calling are
reentrant.  None of the Xlib functions are reentrant but you probably
would get away with it if you're just going to call them and then exit.
Another problem is that when quitting a session Fvwm may die very just
before the X server so your code should accept failure from any Xlib
calls if it is trying to clean up due to FVWM going away. i.e. it must
ignore SIGPIPE and should quit with _exit().

Cheers,
Tim.