<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000"><br>
ime it is highly unlikely that bad memory or malware would result in a
consistent and reliable (albeit sporadic) error at the <span
style="font-weight: bold;">same place</span> 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>
<blockquote style="border: 0px none;"
cite="mid:001b01cee11c$c0772250$416566f0$@dbsolutions.co.nz" type="cite">
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="dugdavid@dbsolutions.co.nz" photoname="David Brennan"
src="cid:part1.01010601.08070505@deltics.co.nz"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:dugdavid@dbsolutions.co.nz"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">David Brennan</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Thu, 14 Nov 2013
22:34</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><meta content="text/html;
charset=ISO-8859-1" http-equiv="Content-Type"><meta content="Microsoft
Word 14 (filtered medium)" name="Generator"><!--[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: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;}
/* 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.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
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.EmailStyle21
        {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]--><div class="WordSection1"><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!<o:p></o:p></span></p><p class="MsoNormal"><span
style="color:#1F497D"><o:p> </o:p></span></p><p class="MsoNormal"><span
style="color:#1F497D"><o:p> </o:p></span></p><p class="MsoNormal"><span
style="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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" 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<o:p></o:p></span></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.<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Cheers,<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Ross.<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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> <a moz-do-not-send="true"
href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a moz-do-not-send="true"
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<o:p></o:p></span></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 style="vertical-align:middle"
class="MsoNormal"><img name="image.jpg"
src="cid:part2.03050301.06000806@deltics.co.nz" id="_x0000_i1025"
border="0" height="25" width="25"><o:p></o:p></p></div><div><p
style="vertical-align:middle" class="MsoNormal"><a
moz-do-not-send="true" href="mailto:ross@stationplaylist.com"><b>Ross
Levis</b></a><o:p></o:p></p></div><div><p style="vertical-align:middle"
class="MsoNormal"><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;font-family:"Times
New Roman","serif";color:#888888">_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post: <a
moz-do-not-send="true" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a moz-do-not-send="true"
href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe:
send an email to <a moz-do-not-send="true"
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><p
class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times
New Roman","serif""><o:p> </o:p></span></p></div><div>_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="ross@stationplaylist.com" photoname="Ross Levis"
src="cid:part1.01010601.08070505@deltics.co.nz"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:ross@stationplaylist.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Ross Levis</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Thu, 14 Nov 2013
21:59</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><meta content="text/html;
charset=ISO-8859-1" http-equiv="Content-Type"><meta content="Microsoft
Word 12 (filtered medium)" name="Generator"><!--[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;}
/* 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;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {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]--><div class="WordSection1"><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.<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></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.<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Cheers,<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Ross.<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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
[<a class="moz-txt-link-freetext" 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<o:p></o:p></span></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 style="vertical-align:middle"
class="MsoNormal"><img moz-do-not-send="true" name="image.jpg"
src="cid:part2.03050301.06000806@deltics.co.nz" id="_x0000_i1025"
height="25" width="25"><o:p></o:p></p></div><div><p
style="vertical-align:middle" class="MsoNormal"><a
moz-do-not-send="true" href="mailto:ross@stationplaylist.com"><b>Ross
Levis</b></a><o:p></o:p></p></div><div><p style="vertical-align:middle"
class="MsoNormal"><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;font-family:"Times
New Roman","serif";color:#888888">_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post: <a
moz-do-not-send="true" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a moz-do-not-send="true"
href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe:
send an email to <a moz-do-not-send="true"
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><p
class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times
New Roman","serif""><o:p> </o:p></span></p></div><div>_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="jsmith@deltics.co.nz" photoname="Jolyon Smith"
src="cid:part5.08090006.08060107@deltics.co.nz"
name="postbox-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:jsmith@deltics.co.nz"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Jolyon Smith</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Thu, 14 Nov 2013
16:38</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<span><span><br>
It is perfectly possible for self to be NIL </span></span><span><span><span>
(the "Free" method relies on this fact)</span></span></span><span><span>.
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.</span> <br>
</span><br>
<span>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>
</span>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!). :)
<br>
</div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="todd.martin.nz@gmail.com" photoname="Todd Martin"
src="cid:part6.00020509.08020307@deltics.co.nz"
name="postbox-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:todd.martin.nz@gmail.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Todd Martin</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Thu, 14 Nov 2013
16:00</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Firstly, since <span style="font-size: 12pt; color: rgb(31, 73,
125);">TCategoryDetails</span> is a descendant of <span
style="font-size: 12pt; color: rgb(31, 73, 125);">TCustomDetails</span>,
it should NEVER be referenced in a method of <span style="font-size:
12pt; color: rgb(31, 73, 125);">TCustomDetails.</span><br>
Secondly, I would say the TCustomDetails object has already been
destroyed.<br>
<br>
Todd.<br>
<br>
<span style="font-size: 12pt; color: rgb(31, 73, 125);"></span>
<br>
<br>
<div>_______________________________________________<br>NZ Borland
Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
<div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div
style="display:table;width:100%;border-top:1px solid
#EDEEF0;padding-top:5px">         <div
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
photoaddress="ross@stationplaylist.com" photoname="Ross Levis"
src="cid:part1.01010601.08070505@deltics.co.nz"
name="compose-unknown-contact.jpg" height="25px" width="25px"></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:ross@stationplaylist.com"
style="color:#737F92
!important;padding-right:6px;font-weight:bold;text-decoration:none
!important;">Ross Levis</a></div> <div
style="display:table-cell;white-space:nowrap;vertical-align:middle;">
<font color="#9FA2A5"><span style="padding-left:6px">Thu, 14 Nov 2013
15:51</span></font></div></div></div>
<div style="color:#888888;margin-left:24px;margin-right:24px;"
__pbrmquotes="true" class="__pbConvBody"><meta content="text/html;
charset=ISO-8859-1" http-equiv="Content-Type"><meta content="Microsoft
Word 12 (filtered medium)" name="Generator"><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:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@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]--><div class="WordSection1"><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...<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">procedure
TCustomDetails.SetModified(Modify: Boolean);<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">begin<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">
FModified := Modify;<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D"> if Modify then<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"> begin<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"> if
Self is TCategoryDetails then MainForm.CategoryChanged := True<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"> else
MainForm.SpotChanged := True;<o:p></o:p></span></p><p class="MsoNormal"><span
style="font-size:12.0pt;color:#1F497D"> end;<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">end;<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">TCategoryDetails
and another class is inherited from TCustomDetails.<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></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"><o:p> </o:p></span></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.<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D"><o:p> </o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Cheers,<o:p></o:p></span></p><p
class="MsoNormal"><span style="font-size:12.0pt;color:#1F497D">Ross.<o:p></o:p></span></p></div><div>_______________________________________________<br>NZ
Borland Developers Group - Delphi mailing list<br>Post:
<a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>Admin:
<a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a><br>Unsubscribe: send an
email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div>
</blockquote>
</body></html>