Jump to content
Joined72

Android 64-bit App Chashes on Access Violation (only from Delphi 12+)

Recommended Posts

Can anyone tell me why raising a hardware exception like an Access Violation crashes a 64-bit Android application, starting with Delphi 12.3 (including Delphi 13), but not up to Delphi 11.3?

 

PS: On 32-bit Android, it works fine in any version of Delphi.

Share this post


Link to post
56 minutes ago, Joined72 said:

Can anyone tell me why raising a hardware exception like an Access Violation crashes a 64-bit Android application, starting with Delphi 12.3 (including Delphi 13), but not up to Delphi 11.3?

 

PS: On 32-bit Android, it works fine in any version of Delphi.

You must give us more informations and you must try to debug the application to see where it crash. After that post some part of relevant source code.

 

We do not have the magical globe.

Share this post


Link to post

put

 

PByte(nil)^ := 0;

 

into a TButton OnClick event and run WITHOUT debug on Andoird 64bit

 

That's all.

  • Haha 1

Share this post


Link to post
57 minutes ago, Joined72 said:

PByte(nil)^ := 0;

Are you kidding me :classic_wacko:

 

Why would you do something like this? It definitely crash the app.

 

You deferencing a nil pointer (and this is already a mistake), and you write inside too.

 

  • Like 1

Share this post


Link to post

I'm just simulating a real Access Violation and on Win32/Win64 the same code only show the classic "EAccessViolation" error message box, while on Android 64bit crashes the app completely but on Android 32bit works as on Win32/Win64 (showing the same EAccessViolation Error message box).

Share this post


Link to post

@Joined72

I tested it on old system and it's true that in Android 64 the app crash.

But I tested various exceptions and only this particolar form of literal dereferencing crash the application.

 

 PByte(nil)^            //<---- this is what in Android 64 crash the app. Also other type of pointer like "PInteger(nil)^" do the same.
                               
 var a: pointer;         
 a := nil;
 PByte(a)^              //<---- this throw an exception     
                                

If you dereference a normal variabile wich value is nil, an exception will throw but the application still run.

 

If no other person on the forum can help, open an issue on QP. Even if that kind of "writing" doesn't make sense, it still shouldn't crash the program.

 

P.S.: Try / except block doesn't work, the application crash inside.

 

Edited by DelphiUdIT

Share this post


Link to post
12 hours ago, DelphiUdIT said:

@Joined72

I tested it on old system and it's true that in Android 64 the app crash.

But I tested various exceptions and only this particolar form of literal dereferencing crash the application.

 


 PByte(nil)^            //<---- this is what in Android 64 crash the app. Also other type of pointer like "PInteger(nil)^" do the same.
                               
 var a: pointer;         
 a := nil;
 PByte(a)^              //<---- this throw an exception     
                                

Can you explain how the PByte(a)^ simple throw the exception?

If I use PByte(a)^ := 0; I see the same crash.

 

Edited by Joined72

Share this post


Link to post
2 hours ago, Joined72 said:

Can you explain how the PByte(a)^ simple throw the exception?

Assign it to a byte var for example, or try to use an helper (.toString) or ....

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×