Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.12.0
-
None
Description
I have a Java class where I override the "finalize" method to know when that the Java object is eligible by garbage collector.
class Foo { ... @Override protected void finalize (){ Log.d(QtApplication.QtTAG, "#### FINALIZE ####"); } ... }
I create an new instance of this Java class with QAndroidJniObject and keep it as a member of my C++ class.
Foo::Foo()
{
m_javaObject = nullptr;
QtAndroid::runOnAndroidThreadSync([&](){
m_javaObject = new QAndroidJniObject(...);
});
}
The problem is that I see the "finalize" log trace of the Java object after few calls on my object, so it means that the Java object could be garbage collected and it should not because I did not delete the pointer "m_javaObject".
Am I missing something ?