Class A holds a reference to an instance of Class B in property mReference (mReference as ClassB)
This reference is NOT nil
But then in one method on ClassA I do
mReference.CallMethod( param1, param2 )
And yet when I step INTO this method and look at SELF - its nil ???
As you might guess this causes no end of issues
I have added a desrtuctor to ClassB - never gets called
mReference isn’t a weakRef so its not going nil on me that I can find
yet there it is - self is nil IN a method on the instance that is being run
Anyone got ANY wild assed guesses how to even track this down ?
yeah - I dont expect a trivial example will show it but thanks anyways
I’m doing this on windows
The same code on macOS is fine but on Window I have a nil self
I’ve never seen such a behaviour in 20+ years of using Xojo before but the app crashes with a nil object exception because of this
not fun
ClassA is one class
ClassB is a differetn class
Not super / sub class at all
breakpoint before the method shows the instance of lassA’s property has a valid reference
step into the method and self is immediately shown as nil
I’ve never seen this and REALLY wish a Xojo engineer who might know WTF is goin on would shime in
Would it be possible to provide @William Yu a binary project file which reproduces this behavior ?
This hits the credibility of the entire working environment.
I suppose if I got a reply saying this was a possibility I would
I cant really file a bug report because I have no way to reproduce this but I can watch it in the debugger
I’ve even put in code like
if self is nil then
System.debuglog currentmethodname + " self is NIL !"
end if
and compiled a binary and run that
When I run it this message shows so something screwy is going on
I’ve hunted down everything I can think of but I cannot find any destructors or events or threads or timers that are altering the property (I’ve converted it to a computed as well JUST in case)
nothing ever seems to touch this yet - self is nil when I get INTO the method that is being called IN the instance that supposedly is now nil
and then everything goes all to hell because I try to pass self on to other things that need it but - its nil - and so the app crashes
I have the very same application for Mac and Windows. Under Mac, even Catalina, Check Writer bug reports are exceptional.
Under Windows, I don’t count the many, many places where I had to deal with unexpected nil. The app is now full of Try-Catch, just to mitigate the Windows issues.
As an experiment, assign the reference to class B to a global variable just before you call the method. Maybe Windows memory management sees the reference as not used and thus garbage collected.
Bugs like this can waste a LOT of our time… This is exactly the type of bug that should be fixed as a high priority IMO, because something very basic in the language/compiler itself is wrong (vs a framework method) , regardless of of how rare they THINK it might be… It being platform specific makes it even worst.
I spoke of these issues in May 2018 and warned people not to rely on xojo windows 64bit, but everyone ignored me and claimed everything was fine. <https://xojo.com/issue/52211>, still there 1.5 years later.
I’ve also recently found that byref isnt added to parameters pointing to structures when using delegates in 32bit which caused me countless hours of wasted time the other day <https://xojo.com/issue/59656> (I’ll make this public when the code is released)
¯\(?)/¯
geoff tells me they have the people and skill sets they need to fix these
Great ! Please do
Compiler bugs like these, when you hit one, is a showstopper
I lucked out and was pointed to Bobs blog that happened to be the very same issue so I could move past it after modifying code
But if not it could have been the end of moving a product to Windows because the functionality that would be broken is so basic