Qt-jambi-interest Archive, November 2007
Functioncall on incomplete object
Message 1 in thread
Hi,
I'm doing some profiling to remove some memoryleaks and I'm getting a
com.trolltech.qt.QNoNativeResourcesException: Function call on
incomplete object of type: com.trolltech.qt.core.QTimer
at com.trolltech.qt.core.QObject.thread(QObject.java:188)
at com.trolltech.qt.QtJambiInternal.threadCheck(QtJambiInternal.java:497)
at com.trolltech.qt.core.QTimer.isActive(QTimer.java:44)
at
com.poseidon.rescue.instruments.navtex.NavtexButtonItem$2.run(NavtexButtonItem.java:59)
at com.trolltech.qt.core.QInvokable.event(QInvokable.java:37)
at com.trolltech.qt.gui.QApplication.exec(Native Method)
at com.poseidon.simulation.Instructor.main(Instructor.java:55)
on this piece of code....
public void cleanup() {
QApplication.invokeLater(new Runnable() {
public void run() {
if (timer != null) {
if (timer.isActive()) {
timer.stop();
}
timer.dispose();
}
}
});
}
Any idea ?
-=Børge Austvold
Message 2 in thread
Børge Nygaard Austvold wrote:
> Hi,
>
> I'm doing some profiling to remove some memoryleaks and I'm getting a
> com.trolltech.qt.QNoNativeResourcesException: Function call on
> incomplete object of type: com.trolltech.qt.core.QTimer
> at com.trolltech.qt.core.QObject.thread(QObject.java:188)
> at
> com.trolltech.qt.QtJambiInternal.threadCheck(QtJambiInternal.java:497)
> at com.trolltech.qt.core.QTimer.isActive(QTimer.java:44)
> at
> com.poseidon.rescue.instruments.navtex.NavtexButtonItem$2.run(NavtexButtonItem.java:59)
>
> at com.trolltech.qt.core.QInvokable.event(QInvokable.java:37)
> at com.trolltech.qt.gui.QApplication.exec(Native Method)
> at com.poseidon.simulation.Instructor.main(Instructor.java:55)
>
> on this piece of code....
Hi Børge,
I see that the documentation for QNoNativeResourcesException needs a few
more lines in it ;-)
This exception is thrown when the C++ part of an object has been
explicitly deleted, and there is still a valid Java reference. In this
case I'm guessing that you:
1. Run the cleanup code twice, hence deleting the timer the first time.
The second time its called you still have a Java reference, but its C++
part is gone and you get the exception.
2. Another option is that you end up deleting the timer because you gave
it a QObject parent that parent has been deleted. QObjects delete all
their children when they go away.
3. You have some other piece of code where you call dispose() on the timer.
4. This is a singleshot timer, in which case it destroys itself after it
has finished emitting the singleshot.
best regards,
Gunnar
> public void cleanup() {
> QApplication.invokeLater(new Runnable() {
> public void run() {
> if (timer != null) {
> if (timer.isActive()) {
> timer.stop();
> }
> timer.dispose();
> }
> }
> });
> }
>
>
> Any idea ?
>
> -=Børge Austvold
>