Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2021-01

PTCGraph Causing 217

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Richters

I've been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program. The error is always on a line with either GetImage() or PutImage() but not the same one. The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error.

I know that if something disrupts the screen. like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in.. I find that this happens.. but lately it seems to happen for no reason.

I don't know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error? It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved.

James

Reply by email

Nikolay Nikolov
to James Richters
James Richters wrote 20 lines
I’ve been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program.The error is always on a line with either GetImage() or PutImage() but not the same one.The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error. I know that if something disrupts the screen… like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in…. I find that this happens.. but lately it seems to happen for no reason. I don’t know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error?It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved.

Can you provide an example program and exact steps to reproduce this bug?

Nikolay

Reply by email

James Richters
to Nikolay Nikolov

I've made a sample program that demonstrates the problem https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91

When I was testing it, I found out that the problem shows up also with PTCCRT.Keypressed,

Procedure to re-produce bug in Putimage
1. Run program in Windows
2. Do something that activates Windows User Account Control like open an administrator command prompt
3. Program crashes with exitcode 217 EAccessViolation: Access violation on line 108 which is doing Putimage, even if you answer NO to user account control

Procedure to re-produce bug in Keypressed
1. UnComment //Until ptccrt.Keypressed; Comment out //Until ptccrt.Keypressed;
2. Run Program in Windows
3. Do something that activates Windows User Account Control like open an administrator command prompt
4. Program crashes with exitcode 217 EAccessViolation: Access violation on line 114 which is doing Keypresed (sometimes the error is on putimage)

Other things that cause it:
Unplug monitor and plug it back in
Change Display settings
Putting computer to sleep
Unknown reasons. system just idle

James

Earlier message 27 lines
From: fpc-pascal On Behalf Of Nikolay Nikolov via fpc-pascal Sent: Thursday, January 7, 2021 2:17 AM To: Cc: Nikolay Nikolov Subject: Re: [fpc-pascal] PTCGraph Causing 217 On 1/6/21 5:44 PM, James Richters via fpc-pascal wrote: I've been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program. The error is always on a line with either GetImage() or PutImage() but not the same one. The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error. I know that if something disrupts the screen. like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in.. I find that this happens.. but lately it seems to happen for no reason. I don't know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error? It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved. Can you provide an example program and exact steps to reproduce this bug? Nikolay

Reply by email

James Richters
to Nikolay Nikolov: Can you provide an example program and exact steps to reproduce this bug? Nikolay

I've made a sample program that demonstrates the problem, it's at: gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91

When I was testing it, I found out that the problem shows up also with PTCCRT.Keypressed,

Procedure to re-produce bug in Putimage
1. Run program in Windows
2. Do something that activates Windows User Account Control like open an administrator command prompt
3. Program crashes with exitcode 217 EAccessViolation: Access violation on line 108 which is doing Putimage, even if you answer NO to user account control

Procedure to re-produce bug in Keypressed
1. UnComment //Until ptccrt.Keypressed; Comment out //Until ptccrt.Keypressed;
2. Run Program in Windows
3. Do something that activates Windows User Account Control like open an administrator command prompt
4. Program crashes with exitcode 217 EAccessViolation: Access violation on line 114 which is doing Keypresed (sometimes the error is on putimage)

Other things that cause it:
Unplug monitor and plug it back in
Change Display settings
Putting computer to sleep
Unknown reasons. system just idle

James

Can you provide an example program and exact steps to reproduce this bug? Nikolay

Reply by email

James Richters
to James Richters: I've made a sample program that demonstrates the problem…

Any idea what's causing this crash yet? Is there some way I can at least detect the error and handle it myself instead of crashing?

James

Earlier message 68 lines
From: fpc-pascal On Behalf Of James Richters via fpc-pascal Sent: Monday, January 11, 2021 9:37 AM To: 'FPC-Pascal users discussions' Cc: James Richters ; 'Nikolay Nikolov' Subject: Re: [fpc-pascal] PTCGraph Causing 217 I've made a sample program that demonstrates the problem https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91 When I was testing it, I found out that the problem shows up also with PTCCRT.Keypressed, Procedure to re-produce bug in Putimage 1. Run program in Windows 2. Do something that activates Windows User Account Control like open an administrator command prompt 3. Program crashes with exitcode 217 EAccessViolation: Access violation on line 108 which is doing Putimage, even if you answer NO to user account control Procedure to re-produce bug in Keypressed 1. UnComment //Until ptccrt.Keypressed; Comment out //Until ptccrt.Keypressed; 2. Run Program in Windows 3. Do something that activates Windows User Account Control like open an administrator command prompt 4. Program crashes with exitcode 217 EAccessViolation: Access violation on line 114 which is doing Keypresed (sometimes the error is on putimage) Other things that cause it: Unplug monitor and plug it back in Change Display settings Putting computer to sleep Unknown reasons. system just idle James From: fpc-pascal < > On Behalf Of Nikolay Nikolov via fpc-pascal Sent: Thursday, January 7, 2021 2:17 AM To: Cc: Nikolay Nikolov < > Subject: Re: [fpc-pascal] PTCGraph Causing 217 On 1/6/21 5:44 PM, James Richters via fpc-pascal wrote: I've been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program. The error is always on a line with either GetImage() or PutImage() but not the same one. The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error. I know that if something disrupts the screen. like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in.. I find that this happens.. but lately it seems to happen for no reason. I don't know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error? It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved. Can you provide an example program and exact steps to reproduce this bug? Nikolay

Reply by email

Nikolay Nikolov
to James Richters
James Richters wrote
Any idea what’s causing this crash yet?Is there some way I can at least detect the error and handle it myself instead of crashing?

I'll take a look and try to reproduce it today or tomorrow. Sorry, I've been busy lately.

Nikolay

Show quoted text 92 lines
James ** ** *From:*fpc-pascal *On Behalf Of *James Richters via fpc-pascal *Sent:* Monday, January 11, 2021 9:37 AM *To:* 'FPC-Pascal users discussions' *Cc:* James Richters ; 'Nikolay Nikolov' *Subject:* Re: [fpc-pascal] PTCGraph Causing 217 I’ve made a sample program that demonstrates the problem https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91 <https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91> When I was testing it, I found out that the problem shows up also with PTCCRT.Keypressed, Procedure to re-produce bug in Putimage 1.Run program in Windows 2.Do something that activates Windows User Account Control like open an administrator command prompt 3.Program crashes with exitcode 217 EAccessViolation: Access violation on line 108 which is doing Putimage, even if you answer NO to user account control Procedure to re-produce bug in Keypressed 1.UnComment //Until ptccrt.Keypressed;Comment out //Until ptccrt.Keypressed; 2.Run Program in Windows 3.Do something that activates Windows User Account Control like open an administrator command prompt 4.Program crashes with exitcode 217 EAccessViolation: Access violation on line 114 which is doing Keypresed (sometimes the error is on putimage) Other things that cause it: Unplug monitor and plug it back in Change Display settings Putting computer to sleep Unknown reasons… system just idle James *From:*fpc-pascal < > *On Behalf Of *Nikolay Nikolov via fpc-pascal *Sent:* Thursday, January 7, 2021 2:17 AM *To:* *Cc:* Nikolay Nikolov < > *Subject:* Re: [fpc-pascal] PTCGraph Causing 217 On 1/6/21 5:44 PM, James Richters via fpc-pascal wrote: I’ve been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program.The error is always on a line with either GetImage() or PutImage() but not the same one.The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error. I know that if something disrupts the screen… like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in…. I find that this happens.. but lately it seems to happen for no reason. I don’t know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error?It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved. Can you provide an example program and exact steps to reproduce this bug? Nikolay

Reply by email

Nikolay Nikolov
to Nikolay Nikolov
Nikolay Nikolov wrote 10 lines
On 1/29/21 12:37 PM, James Richters wrote: > > Any idea what’s causing this crash yet?Is there some way I can at > least detect the error and handle it myself instead of crashing? > I'll take a look and try to reproduce it today or tomorrow. Sorry, I've been busy lately.

Ok, I reproduced it today. It appears that DirectX applications lose access to their DirectDraw surfaces when a UAC screen appears. Thanks, Microsoft! I'll need some time to provide a proper fix for that, but for now you can try this as a workaround. Create a text file, called ptcpas.cfg in your program's directory and type a single line in it:

GDI

This will disable the DirectX console and use GDI for rendering. This might be slower (although, you might not notice the difference on a modern PC), but should get rid of the problem. Please let me know if it doesn't work.

I'll try to get this fixed in the DirectX console as well, but that requires more careful analysis and testing on different versions of Windows, so it'll take some time.

Hope this helps,

Nikolay

Show quoted text 93 lines
> James > > ** > > ** > > *From:*fpc-pascal *On > Behalf Of *James Richters via fpc-pascal > *Sent:* Monday, January 11, 2021 9:37 AM > *To:* 'FPC-Pascal users discussions' > *Cc:* James Richters ; > 'Nikolay Nikolov' > *Subject:* Re: [fpc-pascal] PTCGraph Causing 217 > > I’ve made a sample program that demonstrates the problem > > https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91 > <https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91> > > When I was testing it, I found out that the problem shows up also > with PTCCRT.Keypressed, > > Procedure to re-produce bug in Putimage > > 1.Run program in Windows > > 2.Do something that activates Windows User Account Control like open > an administrator command prompt > > 3.Program crashes with exitcode 217 EAccessViolation: Access > violation on line 108 which is doing Putimage, even if you answer NO > to user account control > > Procedure to re-produce bug in Keypressed > > 1.UnComment //Until ptccrt.Keypressed;Comment out //Until > ptccrt.Keypressed; > > 2.Run Program in Windows > > 3.Do something that activates Windows User Account Control like open > an administrator command prompt > > 4.Program crashes with exitcode 217 EAccessViolation: Access > violation on line 114 which is doing Keypresed (sometimes the error > is on putimage) > > Other things that cause it: > > Unplug monitor and plug it back in > > Change Display settings > > Putting computer to sleep > > Unknown reasons… system just idle > > James > > *From:*fpc-pascal < > > *On Behalf Of > *Nikolay Nikolov via fpc-pascal > *Sent:* Thursday, January 7, 2021 2:17 AM > *To:* > > *Cc:* Nikolay Nikolov < > > *Subject:* Re: [fpc-pascal] PTCGraph Causing 217 > > On 1/6/21 5:44 PM, James Richters via fpc-pascal wrote: > > I’ve been having issues with PTCGraph causing a runtime Error 217 > : EAccessViolation: Access violation at seemingly random times in > my program.The error is always on a line with either GetImage() > or PutImage() but not the same one.The program can run for hours > with no problems doing GetImage and PutImage every second or so, > and then it just stops with this error. > > I know that if something disrupts the screen… like if I install a > program and the Windows user control thing asks for a password, > that ALWAYS causes this to happen, or if I unplug my monitor and > plug it back in…. I find that this happens.. but lately it seems > to happen for no reason. > > I don’t know enough about it to track it down, but is there some > way I Can find out what causes this and prevent the error?It > would be nice if I could detect the condition that causes this > issue, and if I find that the issues is present, just stop trying > to do Getimage() or PutImage() until the condition is resolved. > > Can you provide an example program and exact steps to reproduce this bug? > > Nikolay >

Reply by email

James Richters
to Nikolay Nikolov

Thank you for looking into this and figuring out the problem. I tested it with ptcpas.cfg with GDI in it and that does indeed prevent it from crashing. Thanks for the work around!

Please let me know when DirectX is working again. I'm happy to help test on different versions of Windows.

James

Earlier message 104 lines
From: fpc-pascal On Behalf Of Nikolay Nikolov via fpc-pascal Sent: Sunday, January 31, 2021 4:30 AM To: ; 'FPC-Pascal users discussions' Cc: Nikolay Nikolov Subject: Re: [fpc-pascal] PTCGraph Causing 217 On 1/29/21 3:52 PM, Nikolay Nikolov wrote: On 1/29/21 12:37 PM, James Richters wrote: Any idea what's causing this crash yet? Is there some way I can at least detect the error and handle it myself instead of crashing? I'll take a look and try to reproduce it today or tomorrow. Sorry, I've been busy lately. Ok, I reproduced it today. It appears that DirectX applications lose access to their DirectDraw surfaces when a UAC screen appears. Thanks, Microsoft! I'll need some time to provide a proper fix for that, but for now you can try this as a workaround. Create a text file, called ptcpas.cfg in your program's directory and type a single line in it: GDI This will disable the DirectX console and use GDI for rendering. This might be slower (although, you might not notice the difference on a modern PC), but should get rid of the problem. Please let me know if it doesn't work. I'll try to get this fixed in the DirectX console as well, but that requires more careful analysis and testing on different versions of Windows, so it'll take some time. Hope this helps, Nikolay James From: fpc-pascal On Behalf Of James Richters via fpc-pascal Sent: Monday, January 11, 2021 9:37 AM To: 'FPC-Pascal users discussions' Cc: James Richters ; 'Nikolay Nikolov' Subject: Re: [fpc-pascal] PTCGraph Causing 217 I've made a sample program that demonstrates the problem https://gist.github.com/Zaaphod/936901eb5f31df5044d2bd36a7cf6c91 When I was testing it, I found out that the problem shows up also with PTCCRT.Keypressed, Procedure to re-produce bug in Putimage 1. Run program in Windows 2. Do something that activates Windows User Account Control like open an administrator command prompt 3. Program crashes with exitcode 217 EAccessViolation: Access violation on line 108 which is doing Putimage, even if you answer NO to user account control Procedure to re-produce bug in Keypressed 1. UnComment //Until ptccrt.Keypressed; Comment out //Until ptccrt.Keypressed; 2. Run Program in Windows 3. Do something that activates Windows User Account Control like open an administrator command prompt 4. Program crashes with exitcode 217 EAccessViolation: Access violation on line 114 which is doing Keypresed (sometimes the error is on putimage) Other things that cause it: Unplug monitor and plug it back in Change Display settings Putting computer to sleep Unknown reasons. system just idle James From: fpc-pascal < > On Behalf Of Nikolay Nikolov via fpc-pascal Sent: Thursday, January 7, 2021 2:17 AM To: Cc: Nikolay Nikolov < > Subject: Re: [fpc-pascal] PTCGraph Causing 217 On 1/6/21 5:44 PM, James Richters via fpc-pascal wrote: I've been having issues with PTCGraph causing a runtime Error 217 : EAccessViolation: Access violation at seemingly random times in my program. The error is always on a line with either GetImage() or PutImage() but not the same one. The program can run for hours with no problems doing GetImage and PutImage every second or so, and then it just stops with this error. I know that if something disrupts the screen. like if I install a program and the Windows user control thing asks for a password, that ALWAYS causes this to happen, or if I unplug my monitor and plug it back in.. I find that this happens.. but lately it seems to happen for no reason. I don't know enough about it to track it down, but is there some way I Can find out what causes this and prevent the error? It would be nice if I could detect the condition that causes this issue, and if I find that the issues is present, just stop trying to do Getimage() or PutImage() until the condition is resolved. Can you provide an example program and exact steps to reproduce this bug? Nikolay

Reply by email