Trap signal on Window Manager "X" button clicked?


 
Thread Tools Search this Thread
Operating Systems Solaris Trap signal on Window Manager "X" button clicked?
# 1  
Old 06-11-2011
Trap signal on Window Manager "X" button clicked?

Well, my first post... thanks in advance! Can applications be notified of the X Window close (with "X" button) so the signal handler can run a cleanup process method?

About the app: built with GNU C/C++ on Solaris 10, with WxWidgets. It is launched by a shell script as a background task. The app becomes 'orphaned', a child of init (i think), because of fork/exec code...

The app acts as a controller, launching other apps, etc... We track the number of active users, by modifying a value in shared memory. On a normal entry and exit we modify the value...

Problem scenario: When you click the "X" on the X terminal window that launched the controller app, the controller app and everything it launched is killed... but it doesn't look like the signal handler is being notified of an event... Smilie Should i be getting a SIGHUP or other signal? something special from the window manager?

If I type 'exit' in the controlling X terminal, then the logout kills the interactive shell but the X Window remains open... processes running still...

would love code snippets... thanks, Jim
# 2  
Old 06-12-2011
The process receives an XEvent, not a signal, and it's shut down by the event handler code in something like XtAppMainLoop().
This User Gave Thanks to achenle For This Post:
# 3  
Old 06-12-2011
thank you achenle, sounds exactly right... after playing with wxApp's OnExit, OnFatalException and others (app is built on wxWidgets)... no success getting an event so the app can clean up...

does anyone have a simple example of a wxWidget or X application that can detect the launching x terminal's death? If so, then I can fit that into the wxWidget app...

Before I started playing with the wxApp methods I was getting a message that may provide more clues. It's at the bottom.

thanks again for your help!! Jim


Trapped stdout and stderr when killing the X terminal that launches the wxWidgets app (hitting the 'X' window mgmt button):
X connection to localhost:11.0 host broken (explicit kill or server shutdown)
Gdk-ERROR **: X connection to localhost:11.0 broken (explicit kill or server shutdown).


Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

Trap triggered by "wrong parenthesizes" ?

I have following traps(s) in my code Line 913 triggers one of the traps with parenthesizes around (case-insensitive). Checked by removing them. Since it is a text I do not mind removing the offending () . But why it triggers both traps ? PS Where does the "bad" in trap... (0 Replies)
Discussion started by: annacreek
0 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

unix "trap" command behaviour

Hi I am using "trap" command in my script to prevent the user from running Ctrl-C during the its execution. My script creates number of children processes which in turn create some children processes as well during the execution. When user / tester tries to run Ctrl-C, the parent process is... (1 Reply)
Discussion started by: aoussenko
1 Replies

5. UNIX for Advanced & Expert Users

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have a problem about the Oracle related components. I'm not able to find any answer yet, and waiting for your responses... Here is the configuration of my system: * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or... (1 Reply)
Discussion started by: talipk
1 Replies

6. UNIX and Linux Applications

A question/problem about oracle "tns listener" and "enterprise manager"

hi, I have * an IBM P550 machine, * an AIX 5.3 running on it and * an oracle database, already installed on it. The problem (or question of my own) is: Oracle tns listener, "CT_LISTENER", and the enterprise manager (EM) of the instance, which is uniq instance and called... (0 Replies)
Discussion started by: talipk
0 Replies

7. Linux

By angle-brackets/"pipe" button doesn't work?

How can I configure it? I have a swedish keyboard with swedish keyboard setting. Everything works perfectly (едц) except that button. What can be wrong? /Richard ++ NOTE: It seems like the computer notices the input but that the button isn't assigned to anything (the keyboard-cursor stops).... (1 Reply)
Discussion started by: riwa
1 Replies

8. UNIX for Dummies Questions & Answers

"trap" password expiration message

The majority of the users on our system are "captured" users where they log into script that is launched via their .profile. The password expiration message flashes by very quickly before they get the "menu" portion of the script to continue. Other than a sleep at scripts startup to slow... (2 Replies)
Discussion started by: MizzGail
2 Replies
Login or Register to Ask a Question