15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Can't terminate application after an exception

Roland Pasternack -- rep@jupiter.Legato.COM
Wednesday, September 11, 1996

Environment: VC++ 4.2 and Windows NT 3.51

Since getting the latest version of VC++ and MFC I have seen some unusual
behavior that I have never encountered before.  Normally, if you cause an
exception in your application say by dereferencing a pointer that is set to
0, you pop into the debugger and can then use the "Stop Debugging" menu item
to terminate the application.  The problem is that if I do this the
application is not terminated.  The debugging session is terminated, but the
application window is still present.  I then try to terminate the
application by using the Task List or the Kill command in a DOS window.
Neither of these will do it.  In fact I can logout of the NT session and log
back in, and the application window is still there.  I need to do a total
restart of NT to get rid of it.

To be fair, I am not totally sure that MFC is responsible for this.  NT
should be able to kill the application even if MFC caused the problem, but
it can't.  Something very unusual must be going on in order to see this
behavior.  I am wondering if anyone else has experienced this problem, knows
what is going on, or knows how to prevent it.  

Thanks,
Roland





David Ohlssen -- DAVIDO@COMMERCE.CTECH.AC.ZA
Thursday, September 12, 1996

[Mini-digest: 5 responses]

Roland said:
Since getting the latest version of VC++ and MFC I have seen some =
unusual
behavior that I have never encountered before.  Normally, if you cause =
an

back in, and the application window is still there.  I need to do a =
total
restart of NT to get rid of it.

behavior.  I am wondering if anyone else has experienced this problem, =
knows
what is going on, or knows how to prevent it. =20

Reply:
Yes I get this, usually if the program has some problems.   I have
only seen it since upgrading to NT4.0 b1, and I thought it was
better on NT4b2.   I still use VC4.0 unpatched.    The only other new
thing is that I am using a worker thread in most of my new apps, but it =
checks a flag set by ExitInstance and returns.   If the app can be =
closed without it calling exitinstance perhaps that's it?    I even make =
exitinstance loop waiting for the thread to close.   In all cases I can =
kill with task manager after saying END TASK to the not-responding =
message.   The
few programs that gave this hang-up were getting to the "rewrite" stage, =
and
had evolved with data structures that were becoming too complex to =
remember
what was what.   I suspect some infinite list growth is occurring which
precludes attention to the message queue.    JUST REWRITE YOUR APP!!!

-----From: Gene Sewell 

I've had the same experience.  But, don't blame 4.2!  

I had a similar problem with 4.1 (NT 3.51) about a month ago.  I don't
remember the exact bug - something like calling "delete this" twice in a
dialog box.  Anyway, it did everything you experienced.  I could log off/on
and my dead app would be restored (as a zombie.)  Spy saw it as an object
with no valid process attached.  It was kind of scary.  

Once I fixed the bug, everything was all better....
----
"It is easier to forgive an enemy than to forgive a friend."
                -- William Blake

-----From: Svetlana Guljajeva 

Environment: VC4.2,Win95

Hi!

Are you sure your application hangs "forever"?
I had the same problem once,but then I noticed that my application
terminated in about 5 minutes.The reason of so big delay were memory leaks
and dumping took a lot of time.

P.S.I can be wrong,because I had this problem under Win95.

Svetlana Guljajeva

** svetlana@assert.ee **

-----From: Steve Mark 

I get the same behavior under Win95, however the app I'm working on creates
a bunch of threads and I figured it was having trouble killing them all,
since the problem typically occurs when an exception is thrown in one of
the threads.  I too need to reboot the machine to kill the process.

Steve

-----From: Marty Fried 

I've had this problem with an app that has a dialog with the desktop as
its parent.  I get a message that says it cannot close the app while it
is being debugged, even if it's not.  I asked in this list a while back
for any tips, but never got a response.  I don't know the solution, but
I assume it's because only child windows of my main window get cleaned up
automatically, and the dialog is a child of the desktop window.  If you
figure out anything, please let me know.

Regards,
Marty Fried





| Вернуться в корень Архива |