> Ok, thanks, I'll take a look. I'll be away from computers today so it may
> not be until tmrw.
Thanks for being involved.
In the meanwhile, I found a hack to avoid that exception: in
AppletPlatform::getThisAppContext(), when the calling thread is not
found in any thread group belonging to one pulpcore applet, I return
'mainContext' instead of throwing an error (see below the source).
This is probably not secure at all, but for the moment, it behaves
well on my side.
I deeper investigated, because i was quite surprised for such
behavior : indeed, the examples on your website don't throw such
exception when you close them. Thus, I recompiled the library from SVN
with revisions 522, 520, 518 & 480, but I get exactly the same bug
(tested with the 'Quick' template of the netbeans plugin).
So i don't really understand what happens. Maybe a mistake on my
side ?
Best regards,
Nouk²
PS: The source of my temporary hack:
public AppContext getThisAppContext() {
// In most cases, there will be only one registered App. In
that case, this method
// returns as quickly as possible.
if (allContexts == null) {
return mainContext;
}
synchronized (this) {
// Double check inside the lock
if (allContexts == null) {
return mainContext;
}
// Look through all registered apps and find the context
for this ThreadGroup
// TODO: implement as ThreadLocal instead? (This
implementation was Java 1.1 compatible)
ThreadGroup currentThreadGroup =
Thread.currentThread().getThreadGroup();
for (int i = 0; i < allContexts.size(); i++) {
AppletAppContext context =
(AppletAppContext)allContexts.get(i);
ThreadGroup contextThreadGroup =
context.getThreadGroup();
if (contextThreadGroup == currentThreadGroup ||
contextThreadGroup.parentOf(currentThreadGroup))
{
return context;
}
}
// here is the change:
return mainContext;
// instead of:
// throw new Error("No context found for thread");
}