Companion9x - compiled version crashes

A fork of eePe. It's aim is to provide one tool that works with ALL firmwares!
Post Reply
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Companion9x - compiled version crashes

Post by mbanzi »

I'm working on a little project which requires a few mods to Companion9x. When I build for Windows in VC++10 with the environment set up exactly according to the Wiki, the application crashes when I click on the "Simulate" button (void ModelEdit::on_pushButton_clicked). However the "Simulate Tx" button (void MdiChild::on_SimulateTxButton_clicked) & the "Simulate Model" menu option (void ModelsListWidget::simulate) work fine. I should point at that this is with no code changes made.

Debugging info hasn't helped much, so it's likely something in my environment. Any suggestions?

User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Companion9x - compiled version crashes

Post by Kilrah »

Is it with current svn?
A bug was discovered 2 days ago when Bertrand set up a new environment and had a problem nobody had before, which would cause something similar (and crashes everytime a firmware file was loaded...)
Was fixed in r2278
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

I just tried a fresh svn checkout & build of r2278, but the same happens, only crashes from the model editing dialog. I even tried copying all the DLLs from the current working release 1.48 (r2275) version. Strange...
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Companion9x - compiled version crashes

Post by Kilrah »

Hmm can't reproduce...

What firmware type and options do you have selected? Does it happen with a new document and newly created model or with a specific eeprom?
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

So far, I've always used a new document & newly created model. Changing eeprom, firmware type & options don't seem to make a difference either, but I haven't methodically tested all combinations (yet). I'm compiling the Mac version right now to see if it happens, but I doubt it will.

This reminds me why I stopped developing software for Windows...

Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Companion9x - compiled version crashes

Post by Romolo »

May I ask you which QT version are you using ??
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

Romolo wrote:May I ask you which QT version are you using ??
4.8.0. I may have tried 4.8.4 at one point, but not sure anymore as I've tried so many things :?
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

Just created a new dev environment on a Windows XP VM, set up exactly as in the Wiki with Qt4.8.0, Xerces 3.1.1, XSD 3.3.0, pThreads 2.8.0, NSIS 2.46 & SDL 1.2.15.

c9x compiles fine, but behaves in the same way: crashes clicking the Simulate button in ModelEdit. I'm going to upgrade Qt to 4.8.4 too see if it makes a difference.

Can someone check their versions of the dependencies? Maybe one of the newer versions cause problems.
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Companion9x - compiled version crashes

Post by Romolo »

which firmware have you selected ?
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Companion9x - compiled version crashes

Post by Kilrah »

mbanzi wrote:Can someone check their versions of the dependencies? Maybe one of the newer versions cause problems.
As far as I know all my versions are the ones in the guide. I did not take newer ones when there were some.
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

Romolo wrote:which firmware have you selected ?
I've been using "OpenTx for 9x board", but this does not appear to make a difference.

The debugging process is very slow, as every compile takes about 30 minutes on the VM! I have narrowed it down to:

Code: Select all

void ModelEdit::launchSimulation()
{
  if (GetEepromInterface()->getSimulator()) {
    RadioData simuData = radioData;
    simuData.models[id_model] = g_model;
	
    if (GetEepromInterface()->getCapability(SimulatorType)==1) {
      xsimulatorDialog sd(this);
      sd.loadParams(simuData, id_model);
      sd.exec();
    } else {
      simulatorDialog sd(this);
      sd.loadParams(simuData, id_model);
      sd.exec();
    }
  }
  else {
    QMessageBox::warning(NULL,
        QObject::tr("Warning"),
        QObject::tr("Simulator for this firmware is not yet available"));
  }
}
It appears that the copy of the object "radioData", i.e. "simuData" is somehow causing the issue. I changed this method to remove the object copy and it works, but I'm not sure why yet:

Code: Select all

void ModelEdit::launchSimulation()
{
  if (GetEepromInterface()->getSimulator()) {
    if (GetEepromInterface()->getCapability(SimulatorType)==1) {
      xsimulatorDialog sd(this);
      sd.loadParams(radioData, id_model);
      sd.exec();
    } else {
      simulatorDialog sd(this);
      sd.loadParams(radioData, id_model);
      sd.exec();
    }
  }
  else {
    QMessageBox::warning(NULL,
        QObject::tr("Warning"),
        QObject::tr("Simulator for this firmware is not yet available"));
  }
}
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

Kilrah wrote:As far as I know all my versions are the ones in the guide. I did not take newer ones when there were some.
Thanks Kilrah! I notice the release version actually has QT 4.8.2 DLLs, but I've tried 4.8.0, 4.8.2 & 4.8.4 with no difference.
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

Appears to be related to this line:

Code: Select all

RadioData simuData = radioData;
c9x crashes the moment simuData is accessed. I've been looking at the RadioData class definition in eeprominterface.h, but nothing's jumping out. Any idea why a copy of radioData is being used here?
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Companion9x - compiled version crashes

Post by Romolo »

It's needed as we pass the a copy of the eeprom to the simulator
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Companion9x - compiled version crashes

Post by bertrand35 »

mbanzi wrote:Appears to be related to this line:

Code: Select all

RadioData simuData = radioData;
c9x crashes the moment simuData is accessed. I've been looking at the RadioData class definition in eeprominterface.h, but nothing's jumping out. Any idea why a copy of radioData is being used here?
Stack overflow.

Try this:

RadioData *simuData = new RadioData();
*simuData = radioData;

And add a couple of * where it is used!

Bertrand
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

bertrand35 wrote: Stack overflow.

Try this:

RadioData *simuData = new RadioData();
*simuData = radioData;

And add a couple of * where it is used!

Bertrand
Yep, I was seeing Stack Overflow in the debugger too. Do you mean:

simuData.models[id_model] = g_model;
becomes
**simuData->models[id_model] = g_model;

I get "illegal indirection" errors then. If I change the code to get rid of the errors, I get the Stack Overflow again...
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Companion9x - compiled version crashes

Post by MikeB »

You wont need the ** for:
**simuData->models[id_model] = g_model;
just
simuData->models[id_model] = g_model;

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
mbanzi
Posts: 223
Joined: Thu May 24, 2012 5:53 am
Country: -
Location: San Diego, CA

Re: Companion9x - compiled version crashes

Post by mbanzi »

MikeB wrote:You wont need the ** for:
**simuData->models[id_model] = g_model;
just
simuData->models[id_model] = g_model;

Mike.
Thanks Mike. This is what worked, no more stack overflow crashes!!

Code: Select all

RadioData *simuData = new RadioData();
*simuData = radioData;
simuData->models[id_model] = g_model;
.
.
      sd.loadParams(*simuData, id_model);
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Companion9x - compiled version crashes

Post by ShowMaster »

What is the ppmus option in c9x Taranis FW download option.
Ppm in US?
Thanks
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Companion9x - compiled version crashes

Post by jhsa »

instead of showing the weight percentage in the limits menu, it shows microseconds.. so for a servo center point it will display 1500uS instead of 0%

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Companion9x - compiled version crashes

Post by ShowMaster »

Good to know. What do I want to display?
Based of the default I would use %?
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Companion9x - compiled version crashes

Post by jhsa »

-100% = 988uS
0% = 1500uS
100% = 2012uS

Also we are going way off topic here :)
This should be in another thread..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Companion9x - compiled version crashes

Post by Kilrah »

Most likely yes. That's how all other radios work.

Post Reply

Return to “companion9x”