diff -r e8e63152f320 -r 2a9601315dfc javauis/javalegacyutils/src/eventserver/Close.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/javalegacyutils/src/eventserver/Close.cpp Mon May 03 12:27:20 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 1999-2001 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include + +void CJavaEventSourceBase::DoFinalize(CJavaEventSourceBase* aThis) +// +// Server-side invokation function for finalization +// +{ + aThis->FinalizeSvr(); +} + +EXPORT_C void CJavaEventSourceBase::Close(JNIEnv& aJni) +// +// Remove a reference to the object, this is either from Dispose(), +// or due to event dispatch. When no longer referenced, the object is +// destroyed completely. +// +{ + if (User::LockedDec(iRef)==0) + { + __ASSERT_DEBUG(IsDisposed(),User::Invariant()); // must have called Dispose() + // server side finalization + if (iServer.Handle()!=0) + { + ExecuteV(&CJavaEventSourceBase::DoFinalize,this); + } + // JNI object finalization + FinalizeJni(aJni); + // remove our own weak reference + if (iPeer) + aJni.DeleteWeakGlobalRef(iPeer); + // finally destroy the object + delete this; + } +} + +void CJavaEventSourceBase::OnVmClose() +// +// Remove a reference to the object, this is either from Dispose(), +// or due to event dispatch. When no longer referenced, the object is +// destroyed completely. +// +{ + if (User::LockedDec(iRef)==0) + { + __ASSERT_DEBUG(IsDisposed(),User::Invariant()); // must have called Dispose() + // server side finalization + if (iServer.Handle()!=0) + { + //ExecuteV(&CJavaEventSourceBase::DoFinalize,this); + } + + // finally destroy the object + delete this; + } +}