<html><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000"><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!). :)
<blockquote style="border: 0px none;"
cite="mid:52843CB6.5030603@gmail.com" 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="ross@stationplaylist.com" photoname="Ross Levis"
src="cid:part1.08030709.08020504@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>
<br>
</body></html>