Discussions related to Visual Prolog
choibakk
Active Member
Posts: 26
Joined: 5 Sep 2019 19:30

stringFormat can crash application on shutdown

Unread post by choibakk »

CAVEAT: I'm on build 904 due to some of the 64-bit issues on build 906, so will say I have not tried this on build 906.

Just reporting the strangest issue I ran into in NADYA3 chess, but can reproduce easily enough in a fresh SDI GUI application. I wanted to reuse the same "stringFormat" in my object so created it in the constructor of a custom control. Oddly if you simply start the application, then hit the "close" button, the application crashes with an Access Violation. I resolved my issue by just creating the "stringFormat" in the predicate when I need it.

Here are two lines added to a SDI fresh application to reproduce the problem:

Code: Select all

implement mainForm inherits formWindow     open core, vpiDomains, ribbonControl   facts       string_format_ : stringFormat := erroneous. % <---- HERE   clauses     display(Parent) = Form :-         Form = new(Parent),         Form:show().   constructors     new : (window Parent). clauses     new(Parent) :-         formWindow::new(Parent),         generatedInitialize(),         stdio::outputStream := messageControl_ctl:outputStream,         createCommands(),         ribbonControl_ctl:layout := layout,         setGetNavigationPointsResponder(ribbonControl_ctl:getNavigationPoints),         navigationOverlay::registerSDI(This),         textStatusCell := statusBarCell::new(statusBarControl_ctl, 30),         statusBarControl_ctl:cells := [textStatusCell],         %  If I enable the next line, the program crashes when you close it.         string_format_ := stringFormat::create().  % <---- HERE
Thank,
Craig Hoibakk
User avatar
Thomas Linder Puls
VIP Member
Posts: 1196
Joined: 28 Feb 2000 0:01

Re: stringFormat can crash application on shutdown

Unread post by Thomas Linder Puls »

Thank you, I see a similar problem. We will look at it.
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1196
Joined: 28 Feb 2000 0:01

Re: stringFormat can crash application on shutdown

Unread post by Thomas Linder Puls »

Having looked more at the problem.

I only see the access violation in the debugger; there is no (visible) problem when the program just run and is shut down. Is that also what you see?

The problem happens because the string-format is released after gdi+ has been shutdown. At that point gdi+ has also released the memory, and hence the access violation.

We will categorize this as a no-problem.

But I have a feeling that your original problem is not something invisible during program shutdown. If that is the case then there may be a "real" problem, but to solve it we will need more information.
Regards Thomas Linder Puls
PDC
choibakk
Active Member
Posts: 26
Joined: 5 Sep 2019 19:30

Re: stringFormat can crash application on shutdown

Unread post by choibakk »

Thomas,

Thanks for the update. Based on what you reported, I reintroduced my code into NADYA3.0 Chess to test if my results were different than yours, and I had your exact same results. If I run the executable outside of the debugger I do not receive the Access Violation. Nothing to worry about. Thank you again.

Cheers,
Craig Hoibakk
Post Reply