BKor 0 Posted November 6 Hello everybody, I installed Rad Studio Athens ( with some graphic 3rd parties) and now I am trying to open some projects that I have done in Alexandria ( Rad Studio11). Unfortunatelly I am not succesfull - (access violation at address 00876830 in module "Project1.exe" (offset 6830). Read of address 000000000.) I am working with C++ Builder and before I had no problems with migrating projects from previous versions of Rad Studio. Any advice that could help me running older projects? Share this post Link to post
shineworld 73 Posted November 6 Try to check the stack of called methods, someone try to use a wrong pointer value or object reference. Share this post Link to post
DelphiUdIT 176 Posted November 6 2 hours ago, BKor said: Any advice that could help me running older projects? You can run with debugger and see what's the cause ... Share this post Link to post
BKor 0 Posted November 7 I am not used to work with debugger or stack of called methods. I will try it anyway. Is it of any help if ( in case of not able to interpret debugger window...) I make a screenshot of debugger window and post it? Share this post Link to post
DelphiUdIT 176 Posted November 7 16 minutes ago, BKor said: I am not used to work with debugger or stack of called methods. I will try it anyway. Is it of any help if ( in case of not able to interpret debugger window...) I make a screenshot of debugger window and post it? If you post here the piece of source code interested and the screen shoot, sure someone can help you. Share this post Link to post
BKor 0 Posted November 8 I tried with debugging, it looks like there is problem with for loop: for (int j=0; j<c; j++) The initial value of j after running with debugging is 12 (j=12, see the image) , although it should start the loop with value j=0. There seems to be another problem with c, which shows no value at all. j and c are defined as follows: TForm1 *Form1; const int c=9; TBitmapLayer* pLayer[c]; int i,j=0; int r; bool slip[c]={ false }; bool bing[c]={ false }; bool bong[c]={ false }; int alpha[c]={ 0 }; ..... If I replace in the loop c with cc ( which is defined solely as int (int cc=9 ; ), not as const int (const int c=9;), then the value of cc shows as expected, that is 9. I might be totally wrong, never worked with a debugger before. I attached the image of debugging window below. Is it possible that some kind of "compile settings", which are different from previous version of RAD Studio make this problem? Thanks for any advice. Share this post Link to post
Anders Melander 1782 Posted November 8 18 minutes ago, BKor said: for (int j=0; j<c; j++) The initial value of j after running with debugging is 12 (j=12, see the image) , although it should start the loop with value j=0. You are inspecting the value of j too early; It hasn't been assigned a value yet. The debugger stops on the breakpoint at the location just before code is executed. Not after the code has been executed. If you step one line into the loop then j will have been assigned the initial value. Share this post Link to post
BKor 0 Posted November 9 I tried to migrate to Rad Studio 12 Athens another older project from Rad Studio 11. I run it with debugger and it shows: 1) still within c++ builder window: 2) then continues to pop up c++ builder window with: 3) After I close all pop up windows it shows in application window another series of alerts: Access violation remains in first case in module rtl290.bpl and then in module Project1.exe I could not monitor anything with debugger, because closing the alerts led me to the application with another series of alerts.... Hmmm, thx for any advice Share this post Link to post
BKor 0 Posted November 9 I am sending the CPU window after debugging pointing to ntdll.dll Share this post Link to post
BKor 0 Posted Tuesday at 09:30 PM On 11/8/2024 at 11:19 PM, Anders Melander said: You are inspecting the value of j too early; It hasn't been assigned a value yet. The debugger stops on the breakpoint at the location just before code is executed. Not after the code has been executed. If you step one line into the loop then j will have been assigned the initial value. If I press Shift F7 (trace to next source line) it throws me to the end of "void __fastcall TForm1::FormCreate(TObject *Sender)" and the j stays unchanged. This happens even If I place breakpoints in the code. Thx for any advice. Share this post Link to post
Anders Melander 1782 Posted Tuesday at 09:44 PM I would just use F8 (Step over) but it shouldn't make a difference. Where do you assign a value to c and where is pLayer (which I assume is a dynamic array) initialized? I think you need to show us some more code so we can make sense of what you are doing - and please use the code block. Share this post Link to post
BKor 0 Posted 12 hours ago 22 hours ago, Anders Melander said: I would just use F8 (Step over) but it shouldn't make a difference. Where do you assign a value to c and where is pLayer (which I assume is a dynamic array) initialized? I think you need to show us some more code so we can make sense of what you are doing - and please use the code block. This morning I tried to send the code (via code block) and was refused to submit as potential spam.... I will try to send you this message and afterwards another one with code. In case I will not be allowed to send the code via code block - is there any other way for sending the code? I am sending the header and upper part of the code. I hope it helps somehow. pLayer is part of TImage32 ( graphics32 , 3rd party), defined as array, and c is defined as const int c=9; Pressing F8 does not make any difference. I wonder why the debugger stops with a blue arrow anyway. The same code is compiled and runs without problems in Alexandria. Thx. (also for pointing out the code block ...) Share this post Link to post
BKor 0 Posted 12 hours ago 22 hours ago, Anders Melander said: I would just use F8 (Step over) but it shouldn't make a difference. Where do you assign a value to c and where is pLayer (which I assume is a dynamic array) initialized? I think you need to show us some more code so we can make sense of what you are doing - and please use the code block. I was refused by "Clean Talk"... I will try to send code as .txt in attached file.... MelanderCode.txt Share this post Link to post
Anders Melander 1782 Posted 2 hours ago (edited) 9 hours ago, BKor said: TForm1 *Form1; const int c=9; TBitmapLayer* pLayer[c]; int i,j=0; void __fastcall TForm1::FormCreate(TObject *Sender) { ... for(j = 0; j < c; j++) { pLayer[j] = new TBitmapLayer(Form1->ImageBackground->Layers); pLayer[j]->Bitmap->DrawMode = dmBlend; pLayer[j]->Scaled=true; } ... } I think I can see the problem: You are referencing the Form1 global variable before it has been assigned a value; Your code is in the constructor (or more precisely: an event handler called from the constructor) and the Form1 value isn't assigned until the constructor returns. Do like this instead: void __fastcall TForm1::FormCreate(TObject *Sender) { ... for(j = 0; j < c; j++) { pLayer[j] = new TBitmapLayer(this->ImageBackground->Layers); pLayer[j]->Bitmap->DrawMode = dmBlend; pLayer[j]->Scaled=true; } ... } or simply: void __fastcall TForm1::FormCreate(TObject *Sender) { ... for(j = 0; j < c; j++) { pLayer[j] = new TBitmapLayer(ImageBackground->Layers); pLayer[j]->Bitmap->DrawMode = dmBlend; pLayer[j]->Scaled=true; } ... } Of course it would be best if you could avoid all those global variables (not Form1 but all the others). I don't know if they were just there for debugging this problem. Edited 2 hours ago by Anders Melander Share this post Link to post