Thread overview
Vtable messed up?
Mar 23, 2005
Eelco Hoogendoorn
Mar 23, 2005
J C Calvarese
Mar 23, 2005
Andrew Fedoniouk
Mar 24, 2005
Eelco Hoogendoorn
Mar 25, 2005
J C Calvarese
Mar 25, 2005
Eelco Hoogendoorn
March 23, 2005
I was working on a piece of code that previously had been working fine. Just cleaning up some stuff in some member functions.

When i recompiled it have me an access violation. I threw in some asserts and found out that the error ocurred in another module that tried to call a member function in the class i had modified.

Further research showed that the reference wasnt null. Another interesting thing was that the member function could be called once, but that it crashed the second time it was called (but still the reference wasnt null). Putting assert(0) on the first line of the member function being called accomplished nothing: somehow the member function wasnt really called the first time either.

I thought i had seen it all, but i really dont have a clue anymore whats going on here. One wild guess would be that the Vtable of the class i have been editing has somehow ended up in memory thats being written to by another piece of code, but i wouldnt know how because im not doing anything funky in my code.


March 23, 2005
Eelco Hoogendoorn wrote:
> I was working on a piece of code that previously had been working fine. Just cleaning up some stuff in some member functions.
> 
> When i recompiled it have me an access violation. I threw in some asserts and found out that the error ocurred in another module that tried to call a member function in the class i had modified.
> 
> Further research showed that the reference wasnt null. Another interesting thing was that the member function could be called once, but that it crashed the second time it was called (but still the reference wasnt null). Putting assert(0) on the first line of the member function being called accomplished nothing: somehow the member function wasnt really called the first time either.
> 
> I thought i had seen it all, but i really dont have a clue anymore whats going on here. One wild guess would be that the Vtable of the class i have been editing has somehow ended up in memory thats being written to by another piece of code, but i wouldnt know how because im not doing anything funky in my code. 

Posting some code that causes this problem will drastically increase the chance that Walter is able to fix this. Without code, he may not even believe you that a problem exists.

-- 
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
March 23, 2005
I saw such symptoms many times.
As a rule deletion of all .obj files and full rebuild of
the project helps.

Andrew.


"Eelco Hoogendoorn" <eelco_hoogendoorn@hotmail.com> wrote in message news:d1rhgk$22hv$1@digitaldaemon.com...
>I was working on a piece of code that previously had been working fine. Just cleaning up some stuff in some member functions.
>
> When i recompiled it have me an access violation. I threw in some asserts and found out that the error ocurred in another module that tried to call a member function in the class i had modified.
>
> Further research showed that the reference wasnt null. Another interesting thing was that the member function could be called once, but that it crashed the second time it was called (but still the reference wasnt null). Putting assert(0) on the first line of the member function being called accomplished nothing: somehow the member function wasnt really called the first time either.
>
> I thought i had seen it all, but i really dont have a clue anymore whats going on here. One wild guess would be that the Vtable of the class i have been editing has somehow ended up in memory thats being written to by another piece of code, but i wouldnt know how because im not doing anything funky in my code.
> 


March 24, 2005
deletion of .obj and rebuilding didnt help.

i did manage to narrow down the problem though, and ive found a workaround.

if i comment out this line:

uint Nodes(){return leafnodes + emptynodes + splitnodes;}

all is fine again. i found out that if a put it at the end of my classdefinition it doesnt produce any weird behavior.

i was just ready to move on, when i created another really simple function in a class nested within the one i was first having trouble with.

if i put this:

bit isLeaf(){return false;}

at the end of the classdefinition, no probems, if i put it somewhere else, i again get an access violation.

ill try to further narrow down what the problem is when i have time. im quite sure its the compiler and not me though. im using v119 btw.

i suspect the problem might lie somewhere in the fact that i now have the same function nested four times, like this:

class A{
 class B:A{
  class C{
   class D:C{
    something Foo(Bar b){}
   }
   class E:C{
    something Foo(Bar b){}
   }
   something Foo(Bar b){}
  }
  something Foo(Bar b){}
 }
 something Foo(Bar b){}
}

im not sure how this would cause a problem, but it sure does look quirky if i look at it this way. its nessicary though.

"Andrew Fedoniouk" <news@terrainformatica.com> wrote in message news:d1s78e$2q6u$1@digitaldaemon.com...
>I saw such symptoms many times.
> As a rule deletion of all .obj files and full rebuild of the project helps.
>
> Andrew.
>
>
> "Eelco Hoogendoorn" <eelco_hoogendoorn@hotmail.com> wrote in message news:d1rhgk$22hv$1@digitaldaemon.com...
>>I was working on a piece of code that previously had been working fine. Just cleaning up some stuff in some member functions.
>>
>> When i recompiled it have me an access violation. I threw in some asserts and found out that the error ocurred in another module that tried to call a member function in the class i had modified.
>>
>> Further research showed that the reference wasnt null. Another interesting thing was that the member function could be called once, but that it crashed the second time it was called (but still the reference wasnt null). Putting assert(0) on the first line of the member function being called accomplished nothing: somehow the member function wasnt really called the first time either.
>>
>> I thought i had seen it all, but i really dont have a clue anymore whats going on here. One wild guess would be that the Vtable of the class i have been editing has somehow ended up in memory thats being written to by another piece of code, but i wouldnt know how because im not doing anything funky in my code.
>>
>
> 


March 25, 2005
Eelco Hoogendoorn wrote:
> deletion of .obj and rebuilding didnt help.
> 
> i did manage to narrow down the problem though, and ive found a workaround.
> 
> if i comment out this line:
> 
> uint Nodes(){return leafnodes + emptynodes + splitnodes;}
> 
> all is fine again. i found out that if a put it at the end of my classdefinition it doesnt produce any weird behavior.
> 
> i was just ready to move on, when i created another really simple function in a class nested within the one i was first having trouble with.
> 
> if i put this:
> 
> bit isLeaf(){return false;}
> 
> at the end of the classdefinition, no probems, if i put it somewhere else, i again get an access violation.
> 
> ill try to further narrow down what the problem is when i have time. im quite sure its the compiler and not me though. im using v119 btw.

Yes, that certainly sounds like a bug. It seems like you already have a good idea of what actually causes the bug. I've found that's usually the hardest part in whittling down an example for a bug report.

Here are some tips for reducing buggy code to the smallest size:
http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/BugReports

(The tips may just be common sense, so I don't know how helpful they are.)

-- 
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
March 25, 2005
i got confronted with it again. im now quite sure the problem is this: if i put any function before this function i mentioned that appears in all levels of my nested classes (except for constructors, they dont seem to count, nor their number), i get an access violation.

ill try to minimize is sometime when i have the time. its quite a bulky piece of code, os it may take a while.

"J C Calvarese" <jcc7@cox.net> wrote in message news:d1vm4h$1300$1@digitaldaemon.com...
> Eelco Hoogendoorn wrote:
>> deletion of .obj and rebuilding didnt help.
>>
>> i did manage to narrow down the problem though, and ive found a workaround.
>>
>> if i comment out this line:
>>
>> uint Nodes(){return leafnodes + emptynodes + splitnodes;}
>>
>> all is fine again. i found out that if a put it at the end of my classdefinition it doesnt produce any weird behavior.
>>
>> i was just ready to move on, when i created another really simple function in a class nested within the one i was first having trouble with.
>>
>> if i put this:
>>
>> bit isLeaf(){return false;}
>>
>> at the end of the classdefinition, no probems, if i put it somewhere else, i again get an access violation.
>>
>> ill try to further narrow down what the problem is when i have time. im quite sure its the compiler and not me though. im using v119 btw.
>
> Yes, that certainly sounds like a bug. It seems like you already have a good idea of what actually causes the bug. I've found that's usually the hardest part in whittling down an example for a bug report.
>
> Here are some tips for reducing buggy code to the smallest size: http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/BugReports
>
> (The tips may just be common sense, so I don't know how helpful they are.)
>
> -- 
> Justin (a/k/a jcc7)
> http://jcc_7.tripod.com/d/