Trying to figure out this weird situation (and crashes) [solved]
I have a tab control, 3 tabs, and listboxes in two if them (hierachial data), and I enable/disable tabs based on if the listbox has a selection or not. I also made a small proof script for this to show what I mean.
Now, the real script does a lot more than just enable/disable the tabs, but the weird thing is I get this error:
Script Error: Line 512
<span style="color:rgb(255, 0, 0)">Error: cannot access member `valueOf' of deleted QObject</span>
<span style="color:rgb(255, 0, 0)">Stack Trace: ()@/Volumes/DuoDisk/DAZBoot/devContent/Scripts/Roll Em Up.dsa:512</span>
After a few steps around, in this code:
this.wTabControl.setTabEnabled(this.wSectionGroupBox, true);
So, it looks like for some reason the members of the overlaying class for some reason gets deleted, the offending object is this.wSectionGroupBox as when I try to debug() it I get the same error.
What makes this difficult is that DS crashes rather frequently or (the error is shown, but even debugger while stepping just shoots DS down, so I get flashbacks from the old Mac OS 7 development cycle (edit-test-crash-reboot)
Any ideas? What I do "besides activating tabs" is manipulating viewport scene elements, but that doesn't crash as long as I refrain from activating/deactivating tabs.
Comments
How are you enabling/disabling? Are you trying to access a widget on a disabled tab?
Enable/Disable this way:
this.wTabControl.setTabEnabled(this.wSectionGroupBox, true);
I have to check if it does something on a disabled tab, might be so (usually I try to finish populating a GUI before showing it), I will check that.
I do this:
this.wTabControl.currentChanged.connect( this, "tabClicked()" );
And then in
BWCRollUp.prototype.tabClicked = function(wWidget)
I do the fiddling, can it be that the tab is not actually active when this callback fires?
Not sure, it's not a feature I've used - the dialogue should exist itself. Are you asking which tab is active (and which controls are on) before trying to do anything in the callback?
logit is my own function that logs and flushes DS log (so I can see what happened after a crash) and it also is controllable from a const global to log or not.
logit("handleSaveSection()");
logit("TAB:"+this.wTabControl);
logit("TAB:"+this.wSetupBuilderGroupBox);
this.wTabControl.setTabEnabled(this.wSetupBuilderGroupBox, true);
Gives:
handleSaveSection()
TAB:[object Object]
Error: cannot access member `valueOf' of deleted QObject
OK, I removed the TabControl and put the three panes stacked vertical on the windows, and everything seems to work as expected (activation/deactivation) of panes and controls, no crashes, so my guess is that something with the tabcontrol disliked the way I was doing things.
So, all well, jiust almost a week fighting a GUI issue instead of developing the actual script, but here we go! Cheer up, it could be worse. The guy cheered up and it got worse ;-)
Wow - this is a weird one - maybe different from the thread but very similar.
Just jumping at last into scripting (and wandering in a lot of fog ... but that is by-the-by). Worked up the little script in the screenshot, ran it and it did exactly what I asked of it. Go to run it again and I get the error "Cannot access member "scene" of deleted QObject. No idea why or how to get around this. Any thoughts or suggestions? Many thanks in advance.
PS while I'm here something those who know might now. In trying to build my understanding I was looking at all the variables via a message box (like the script) as I went. But for almost everything except the numerics the result was [object Object]. ?????????
Cheers, Lx
I guess you are doing something similar to what I did, which was as I describled fiddling with struff that hadn't been properly initalized
Unfortunately your script is unreadable like that.
Sorry it wasn't readable. The issue fixed itself on an exit-and-reload - so just some sort of glitch. Still interested to know what [object Object] means, And is there any good resource to understand the numbers in a quaterion rotation? I cannot make head or tail of what my script reports as the numbers ... but it turns up in the GUI as something sensible. I'd love to know how to do it from first principles.
[object Object] usually comes up, for me, if I try to print something unprintable - a structure rather than a numeriic or text entry for example.
Thanks Richard. You are right ... [object Object] means you think it should be, say, a number but it is in fact still a reference to an object or some such and at least another step is required.
I also crash-tackled quaterions and have posted two simple scripts in the "learn scripting" thread that should help anyone who comes asking about quaterions, euler angles and the parameter tabe degrees. Cheers. Lx