Page 1 of 1

Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 5:52 am
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?

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 10:03 am
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

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 3:54 pm
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...

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 4:31 pm
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?

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 5:37 pm
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...

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 8:43 pm
by Romolo
May I ask you which QT version are you using ??

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 9:18 pm
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 :?

Re: Companion9x - compiled version crashes

Posted: Tue Sep 24, 2013 11:03 pm
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.

Re: Companion9x - compiled version crashes

Posted: Wed Sep 25, 2013 8:52 pm
by Romolo
which firmware have you selected ?

Re: Companion9x - compiled version crashes

Posted: Wed Sep 25, 2013 9:07 pm
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.

Re: Companion9x - compiled version crashes

Posted: Wed Sep 25, 2013 10:27 pm
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"));
  }
}

Re: Companion9x - compiled version crashes

Posted: Wed Sep 25, 2013 10:29 pm
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.

Re: Companion9x - compiled version crashes

Posted: Thu Sep 26, 2013 3:17 am
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?

Re: Companion9x - compiled version crashes

Posted: Thu Sep 26, 2013 5:30 am
by Romolo
It's needed as we pass the a copy of the eeprom to the simulator

Re: Companion9x - compiled version crashes

Posted: Fri Sep 27, 2013 5:22 am
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

Re: Companion9x - compiled version crashes

Posted: Fri Sep 27, 2013 7:33 am
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...

Re: Companion9x - compiled version crashes

Posted: Fri Sep 27, 2013 9:45 am
by MikeB
You wont need the ** for:
**simuData->models[id_model] = g_model;
just
simuData->models[id_model] = g_model;

Mike.

Re: Companion9x - compiled version crashes

Posted: Sat Sep 28, 2013 7:15 am
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);

Re: Companion9x - compiled version crashes

Posted: Wed Oct 09, 2013 6:55 pm
by ShowMaster
What is the ppmus option in c9x Taranis FW download option.
Ppm in US?
Thanks

Re: Companion9x - compiled version crashes

Posted: Wed Oct 09, 2013 6:58 pm
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

Re: Companion9x - compiled version crashes

Posted: Thu Oct 10, 2013 4:01 am
by ShowMaster
Good to know. What do I want to display?
Based of the default I would use %?

Re: Companion9x - compiled version crashes

Posted: Thu Oct 10, 2013 8:24 am
by jhsa
-100% = 988uS
0% = 1500uS
100% = 2012uS

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

João

Re: Companion9x - compiled version crashes

Posted: Thu Oct 10, 2013 8:30 am
by Kilrah
Most likely yes. That's how all other radios work.