Hi,

strId is set to "1911" for testing purposes, but sometimes it is a bad ptr and I don't know why?

Possible because this function gets called from another thread, well I say that, the other thread emits a signal which causes this code to be called, the other thread does pass across a pointer to the following data structure :

Qt Code:
  1. struct MESSAGEDATA
  2. {
  3. QString strId;
  4. QString strData;
  5. };
To copy to clipboard, switch view to plain text mode 

Thread just does :

Qt Code:
  1. MESSAGEDATA can[MAX];
  2.  
  3. can[0].strId = "1911";
  4. can[0].strData = "0F0F0F0F0F0F";
  5. emit modifytable( &can[0] );
To copy to clipboard, switch view to plain text mode 

Quite possible I've answered my own question, it could be the fact that passing a pointer to this structure is not safe?

And the modifytable slot function is :

Qt Code:
  1. void CanTree::updatetable( MESSAGEDATA* pData )
  2. {
  3. m_pModel->updateTable( pData->strData, pData->strId );
  4. }
To copy to clipboard, switch view to plain text mode 

Which updates the model with the relevant data.

Regards,
Steve