delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/14/16:04:00

Message-ID: <19991014153345.382.rocketmail@web122.yahoomail.com>
Date: Thu, 14 Oct 1999 08:33:45 -0700 (PDT)
From: Mohamed Saad <bazramit AT yahoo DOT com>
Subject: exit() makes my program crash!!!! (The solution)
To: djgpp AT delorie DOT com
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Hello all,
   thanks for replying to my previous msg. Thank u
damian. Thank you Eli. :)
   well... the problem is now over. As damian
suggested, i tried to set the mode back to text mode,
and the problem was over!

   but... i still dunno why it happened! i had a look
on the source code of exit() and i found it sets the
mode back to text mode before calling _exit()!
   well... when my program freezed, it was STILL in
640*480*65k colors!! which gave me the indication that
the problem happens in exit()! 
   but when i replace exit() with _exit() the problem
still occurred!! it also occurred with __exit()!

{Note: isn't this line intended to return to text
mode?
/////////////////////////////////////////
//ripped from exit.c
/* in case the program set it this way */
  setmode(0, O_TEXT);
/////////////////////////////////////////

so... hmmm... i looked at setmode.c but couldn't
understand what it do!! :)

well... i am still unable to understand what caused
the problem! the only things that is called before
setmode() are the destructors, functions registered
with atexit and closing files...

I have checked the destructors and they are all clean!
i haven't registered any functions with atexit! and i
don't think closing files may cause a freeze!!

hmmm... any suggestions?? Thanx in advance!!

Urs forever,
	Mohamed El Dawy

P.S. I have discovered that i do not free() some
malloc'ed() memory! may this be the reason?

P.P.S. before i forget, can i combine new, delete, and
realloc?? can i realloc memory grabbed by new?? can i
then delete it?? 
can i free memory grabbed by new, using free()??

P.P.P.S. I am unable to submit the code because it is
ENORMOUS!!!!! i can't make it any smaller!! :)

P.P.P.P.S. I am not using allegro!

=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019