Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!ATHENA.MIT.EDU!swick From: swick@ATHENA.MIT.EDU (Ralph R. Swick) Newsgroups: comp.windows.x Subject: Re: XtAppMainLoop - are there alternatives? Message-ID: <8912121813.AA12898@LYRE.MIT.EDU> Date: 12 Dec 89 18:13:43 GMT References: <1038@hedora.cs.utexas.edu> Sender: root@athena.mit.edu (Wizard A. Root) Organization: DEC/MIT Project Athena Lines: 21 Date: 12 Dec 89 16:57:51 GMT From: snorkelwacker!usc!cs.utexas.edu!mbarnett@BLOOM-BEACON.MIT.EDU (Michael Barnett) void quit() { XtDestroyApplicationContext(app_context); NOT_DONE = 0; } the application works fine, KCL allows me to define a function main-loop that does nothing but call main_loop in the C code. but when i try to call quit (from a callback), i get a segmentation violation (which occurs in the function main_loop, after the while loop). Don't destroy the application context from within XtDispatchEvent (i.e. from within a callback). This destroys lots of state that Xt needs. If you simply set your flag and do the destroy when XtDispatchEvent returns, you'll be safe.