http://gambaswiki.org/bugtracker/edit?object=BUG.893&from=L21haW4-
Tobias BOEGE reported a new bug.
Summary
-------
Variables become Null after "Unable to load class file" error?
Type : Bug
Priority : Medium
Gambas version : 3.8.90 (TRUNK)
Product : Unknown
Description
-----------
Hi Benoit,
I hit a bug again, approximately this[0] level of weirdness; it's actually
the same project, this time apparently not related to Settings, but again
deep down in the interpreter.
The bug works as follows: I have a library which depends on gb.image(.io) to
load and save images. It contains a line such as
Try hImage = Image.Load(...)
in one of its modules. Now I use this library in a project which does *not*
have gb.image(.io) ticked. Apparently when the library is loaded, its
dependencies gb.image(.io) are *not* automatically loaded, too. It so
happens that the above line would fail (if I omit the Try) with an error:
Cannot load class 'Image': Unable to load class file
but the Try maskes this error away. I find this strange to begin with.
Shouldn't the library's dependencies be loaded, too, even if they are not
explicit dependencies of the project?
But the actual error shows itself a little later. After this failed Try
statement, if you only have a deep enough function call stack, variables in
non-exported modules magically become Null. (If the module is exported, the
variables retain their values.)
I attach two projects which demonstrate this behaviour (at least on my
system and I have just compiled Gambas from scratch after completely
uninstalling it). The one, "image-lib" is the library. You compile it and
install it with the new library mechanism, then open the other project,
"image-test", and add the library there. The main code is
Public Sub Main()
MyModule.Init("xyz") ' Initialise a variable in a non-exported module
Module1.Init() ' Raise the Try'd image class loading error
Debug MyModule.Str ' Show that the variable is still good
MyOther.Test(100) ' Show the variable after 100 recursive calls, where
it is somehow Null
End
yields
Main.Main.6: xyz
MyOther.Test.5:
Regards,
Tobi
[0] http://sourceforge.net/p/gambas/mailman/message/34523004/
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user