<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Times New Roman \, serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>No packages being used. Still looking.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> delphi-bounces@listserver.123.net.nz [mailto:delphi-bounces@listserver.123.net.nz] <b>On Behalf Of </b>Jolyon Smith<br><b>Sent:</b> Friday, 15 November 2013 8:37 a.m.<br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG] IsClass access violation<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><br>ime it is highly unlikely that bad memory or malware would result in a consistent and reliable (albeit sporadic) error at the <b>same place</b> in your code every time.<br><br>A corrupt DLL might be involved and if you are using runtime packages this might include those (since the error occurs in IsClass, replacing the appropriate rtl.bpl could be a first option - but only if you are using runtime packages). Also if you are using runtime packages, make sure that the machine has all the right versions of your application packages. A mismatch in typeinfo in different versions of a reference runtime package can lead to strange issues.<br><br>If you aren't using runtime packages (or even if you are) then as well as checking for correctly paired Free/NIL'ing of references I strongly recommend you also check for any hard type-casts to the TCustomDetails() type, and sanity check them as well.<br><br><o:p></o:p></p><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><img width=25 height=25 id="_x0000_i1025" src="cid:image001.jpg@01CEE206.8F299030" name=compose-unknown-contact.jpg><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><a href="mailto:dugdavid@dbsolutions.co.nz"><b>David Brennan</b></a><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='color:#9FA2A5'>Thu, 14 Nov 2013 22:34</span><o:p></o:p></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='color:#1F497D'>The most annoying type of bug – one which only occurs on one computer. There is always the possibility that it is a problem with that particular machine, bad memory or some a corrupt DLL/malware, etc. Most of the time when we have run into something like this it turns out to be our code still, but the thought that it might not be and you’re going on a wild goose chase is frustrating!</span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> [<a href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Ross Levis<br><b>Sent:</b> Thursday, 14 November 2013 9:59 p.m.<br><b>To:</b> 'NZ Borland Developers Group - Delphi List'<br><b>Subject:</b> Re: [DUG] IsClass access violation</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>This code is working in about 1100 installations for over 12 months, and executed around 1000 times a day at each installation, and the class referencing is working correctly to determine if it is a TCategoryDetails object or not. Whether it should or shouldn’t be done is another matter. I don’t see any logical reason not to.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Only 1 user is having an occasional problem at the same line of code, twice in the last 2 weeks. I can’t find a situation where the object has been freed and my object storage not updated, but I suspect it must have been somehow. I’ll have a closer look.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> [<a href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Jolyon Smith<br><b>Sent:</b> Thursday, 14 November 2013 4:39 p.m.<br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG] IsClass access violation</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><br>It is perfectly possible for self to be NIL (the "Free" method relies on this fact). If SetModified is not virtual then you can happily call it with a NIL reference - it will only blow up when the code attempts to access any member data. <br><br>i.e. if self were NIL then the AV would occur on the FModified := Modify line.<br><br>Since you are not getting an AV on that line then the one thing you can be sure of is that self is not NIL. :)<br><br><br>The read address in that access violation is very odd. If the object were previously valid but destroyed then I would expect a more "random" looking address. It also seems a curiously high address.<br><br>Another possibility is that the SetModified() method has been called using a hard-typecast on some other value, not even necessarily a valid object reference. If so, then the procedure will be running in some sort of no-mans land where setting the memory that it thinks is "fModified" is acceptable but will do unpredictable damage with the wheels only coming off when calling up the class hierarchy to check the class type.<br><br>e.g. in a form event: TCustomDetails(self).SetModified(FALSE) will compile and run but the line that sets fModified := Modify will actually overwrite some private member data of the TForm (assuming that TCustomDetails is not a form class) and if it doesn't blow up in your face right away something almost certainly will go "bang" at some point later.<br><br>If that is what's going on, the fact that it is blowing up when attempting to call the IsClass method suggests that whatever has been type cast isn't even an object reference at all.<br><br>It's a puzzle, that's for sure.<br><br>Are there any other potential factors ? Runtime packages ? Threads ?<br><br><br>fwiw - an ancestor class referencing a sub-class is unusual and often reflects a shortcoming in the OO model, but I wouldn't go so far as Todd as saying that it should NEVER be done. Without reviewing your class hierarchy it's impossible to say for sure. There may be good reasons for it and it is unlikely to be directly related to your problem in any case (he said, offering up a hostage to fortune!). :) <o:p></o:p></p><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><img border=0 width=25 height=25 id="_x0000_i1026" src="cid:image002.jpg@01CEE206.8F299030" name=image.jpg><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><a href="mailto:ross@stationplaylist.com"><b>Ross Levis</b></a><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='color:#9FA2A5'>Thu, 14 Nov 2013 15:51</span><o:p></o:p></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’ve got a strange error occurring for just one user where this procedure is failing...</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>procedure TCustomDetails.SetModified(Modify: Boolean);</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> FModified := Modify;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Modify then</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Self is TCategoryDetails then MainForm.CategoryChanged := True</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> else MainForm.SpotChanged := True;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>TCategoryDetails and another class is inherited from TCustomDetails.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal>Access violation at address 004047DC in module 'SPLCreator.exe'. Read of address FFFFFFDF.<o:p></o:p></p><p class=MsoNormal>main thread ($87c):<o:p></o:p></p><p class=MsoNormal>004047dc SPLCreator.exe System TObject.InheritsFrom<o:p></o:p></p><p class=MsoNormal>00404742 SPLCreator.exe System @IsClass<o:p></o:p></p><p class=MsoNormal>005dc6a6 SPLCreator.exe SPMain 3831 +4 TCustomDetails.SetModified<o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Would this happen if Self was nil or invalid? I don’t see how that could happen but just wondering how this can happen.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.</span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</span><o:p></o:p></p></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'> </span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></span></p></div></div><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img border=0 width=25 height=25 id="_x0000_i1027" src="cid:image001.jpg@01CEE206.8F299030" name=compose-unknown-contact.jpg><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><a href="mailto:ross@stationplaylist.com"><b>Ross Levis</b></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#9FA2A5'>Thu, 14 Nov 2013 21:59</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>This code is working in about 1100 installations for over 12 months, and executed around 1000 times a day at each installation, and the class referencing is working correctly to determine if it is a TCategoryDetails object or not. Whether it should or shouldn’t be done is another matter. I don’t see any logical reason not to.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Only 1 user is having an occasional problem at the same line of code, twice in the last 2 weeks. I can’t find a situation where the object has been freed and my object storage not updated, but I suspect it must have been somehow. I’ll have a closer look.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> <a href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a> [<a href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On Behalf Of </b>Jolyon Smith<br><b>Sent:</b> Thursday, 14 November 2013 4:39 p.m.<br><b>To:</b> NZ Borland Developers Group - Delphi List<br><b>Subject:</b> Re: [DUG] IsClass access violation</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><br>It is perfectly possible for self to be NIL (the "Free" method relies on this fact). If SetModified is not virtual then you can happily call it with a NIL reference - it will only blow up when the code attempts to access any member data. <br><br>i.e. if self were NIL then the AV would occur on the FModified := Modify line.<br><br>Since you are not getting an AV on that line then the one thing you can be sure of is that self is not NIL. :)<br><br><br>The read address in that access violation is very odd. If the object were previously valid but destroyed then I would expect a more "random" looking address. It also seems a curiously high address.<br><br>Another possibility is that the SetModified() method has been called using a hard-typecast on some other value, not even necessarily a valid object reference. If so, then the procedure will be running in some sort of no-mans land where setting the memory that it thinks is "fModified" is acceptable but will do unpredictable damage with the wheels only coming off when calling up the class hierarchy to check the class type.<br><br>e.g. in a form event: TCustomDetails(self).SetModified(FALSE) will compile and run but the line that sets fModified := Modify will actually overwrite some private member data of the TForm (assuming that TCustomDetails is not a form class) and if it doesn't blow up in your face right away something almost certainly will go "bang" at some point later.<br><br>If that is what's going on, the fact that it is blowing up when attempting to call the IsClass method suggests that whatever has been type cast isn't even an object reference at all.<br><br>It's a puzzle, that's for sure.<br><br>Are there any other potential factors ? Runtime packages ? Threads ?<br><br><br>fwiw - an ancestor class referencing a sub-class is unusual and often reflects a shortcoming in the OO model, but I wouldn't go so far as Todd as saying that it should NEVER be done. Without reviewing your class hierarchy it's impossible to say for sure. There may be good reasons for it and it is unlikely to be directly related to your problem in any case (he said, offering up a hostage to fortune!). :) <o:p></o:p></p><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><img border=0 width=25 height=25 id="_x0000_i1028" src="cid:image002.jpg@01CEE206.8F299030" name=image.jpg><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><a href="mailto:ross@stationplaylist.com"><b>Ross Levis</b></a><o:p></o:p></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='color:#9FA2A5'>Thu, 14 Nov 2013 15:51</span><o:p></o:p></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’ve got a strange error occurring for just one user where this procedure is failing...</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>procedure TCustomDetails.SetModified(Modify: Boolean);</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> FModified := Modify;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Modify then</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Self is TCategoryDetails then MainForm.CategoryChanged := True</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> else MainForm.SpotChanged := True;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>TCategoryDetails and another class is inherited from TCustomDetails.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal>Access violation at address 004047DC in module 'SPLCreator.exe'. Read of address FFFFFFDF.<o:p></o:p></p><p class=MsoNormal>main thread ($87c):<o:p></o:p></p><p class=MsoNormal>004047dc SPLCreator.exe System TObject.InheritsFrom<o:p></o:p></p><p class=MsoNormal>00404742 SPLCreator.exe System @IsClass<o:p></o:p></p><p class=MsoNormal>005dc6a6 SPLCreator.exe SPMain 3831 +4 TCustomDetails.SetModified<o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Would this happen if Self was nil or invalid? I don’t see how that could happen but just wondering how this can happen.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.</span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</span><o:p></o:p></p></div></div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman , serif","serif"'> </span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></span></p></div></div><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img border=0 width=25 height=25 id="_x0000_i1029" src="cid:image003.jpg@01CEE206.8F299030" name=postbox-contact.jpg><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><a href="mailto:jsmith@deltics.co.nz"><b>Jolyon Smith</b></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#9FA2A5'>Thu, 14 Nov 2013 16:38</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'><br>It is perfectly possible for self to be NIL (the "Free" method relies on this fact). If SetModified is not virtual then you can happily call it with a NIL reference - it will only blow up when the code attempts to access any member data. <br><br>i.e. if self were NIL then the AV would occur on the FModified := Modify line.<br><br>Since you are not getting an AV on that line then the one thing you can be sure of is that self is not NIL. :)<br><br><br>The read address in that access violation is very odd. If the object were previously valid but destroyed then I would expect a more "random" looking address. It also seems a curiously high address.<br><br>Another possibility is that the SetModified() method has been called using a hard-typecast on some other value, not even necessarily a valid object reference. If so, then the procedure will be running in some sort of no-mans land where setting the memory that it thinks is "fModified" is acceptable but will do unpredictable damage with the wheels only coming off when calling up the class hierarchy to check the class type.<br><br>e.g. in a form event: TCustomDetails(self).SetModified(FALSE) will compile and run but the line that sets fModified := Modify will actually overwrite some private member data of the TForm (assuming that TCustomDetails is not a form class) and if it doesn't blow up in your face right away something almost certainly will go "bang" at some point later.<br><br>If that is what's going on, the fact that it is blowing up when attempting to call the IsClass method suggests that whatever has been type cast isn't even an object reference at all.<br><br>It's a puzzle, that's for sure.<br><br>Are there any other potential factors ? Runtime packages ? Threads ?<br><br><br>fwiw - an ancestor class referencing a sub-class is unusual and often reflects a shortcoming in the OO model, but I wouldn't go so far as Todd as saying that it should NEVER be done. Without reviewing your class hierarchy it's impossible to say for sure. There may be good reasons for it and it is unlikely to be directly related to your problem in any case (he said, offering up a hostage to fortune!). :) <o:p></o:p></span></p></div><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img border=0 width=25 height=25 id="_x0000_i1030" src="cid:image004.jpg@01CEE206.8F299030" name=postbox-contact.jpg><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><a href="mailto:todd.martin.nz@gmail.com"><b>Todd Martin</b></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#9FA2A5'>Thu, 14 Nov 2013 16:00</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>Firstly, since TCategoryDetails is a descendant of </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D'>TCustomDetails</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>, it should NEVER be referenced in a method of </span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D'>TCustomDetails.</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'><br>Secondly, I would say the TCustomDetails object has already been destroyed.<br><br>Todd.<br><br><br><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></span></p></div></div><div style='margin-left:15.0pt;margin-top:18.0pt;margin-right:15.0pt;margin-bottom:6.0pt'><div style='border:none;border-top:solid #EDEEF0 1.0pt;padding:3.0pt 0cm 0cm 0cm;display:table'><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><img border=0 width=25 height=25 id="_x0000_i1031" src="cid:image001.jpg@01CEE206.8F299030" name=compose-unknown-contact.jpg><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><a href="mailto:ross@stationplaylist.com"><b>Ross Levis</b></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='vertical-align:middle'><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#9FA2A5'>Thu, 14 Nov 2013 15:51</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p></div></div></div><div style='margin-left:14.4pt;margin-right:14.4pt'><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>I’ve got a strange error occurring for just one user where this procedure is failing...</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>procedure TCustomDetails.SetModified(Modify: Boolean);</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> FModified := Modify;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Modify then</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> begin</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> if Self is TCategoryDetails then MainForm.CategoryChanged := True</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> else MainForm.SpotChanged := True;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>end;</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>TCategoryDetails and another class is inherited from TCustomDetails.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal>Access violation at address 004047DC in module 'SPLCreator.exe'. Read of address FFFFFFDF.<o:p></o:p></p><p class=MsoNormal>main thread ($87c):<o:p></o:p></p><p class=MsoNormal>004047dc SPLCreator.exe System TObject.InheritsFrom<o:p></o:p></p><p class=MsoNormal>00404742 SPLCreator.exe System @IsClass<o:p></o:p></p><p class=MsoNormal>005dc6a6 SPLCreator.exe SPMain 3831 +4 TCustomDetails.SetModified<o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Would this happen if Self was nil or invalid? I don’t see how that could happen but just wondering how this can happen.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Cheers,</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;color:#1F497D'>Ross.</span><o:p></o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#888888'>_______________________________________________<br>NZ Borland Developers Group - Delphi mailing list<br>Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<o:p></o:p></span></p></div></div></div></body></html>