Greetings,

I am trying to pass a pointer as a parameter using signal/slot connections. I am having problems accessing the data on the slot side. On the 2nd or 3rd access the app crashes.

I have a number of other successful connections between these 2 classes already but none attempt to pass a pointer as a parameter. It would seem to be a simple thing to pass a void*. Is there a particular way to pass a void* using signal/slot connections?

Does anyone see what I am doing wrong?

Using Qt 4.2.2 and MSVC 2005.

Here are some code snippets...

Qt Code:
  1. // GetProperty Map
  2. typedef struct deviceData
  3. {
  4. uint nCounter; // property counter
  5. void* pData; // device data pointer
  6.  
  7. } DevData;
  8.  
  9. typedef std::map<unsigned long, DevData*> GetPropertyMap;
  10. typedef GetPropertyMap::iterator GetPropertyMapIter;
  11. typedef GetPropertyMap::value_type GetPropertyEntry;
  12.  
  13. GetPropertyMap m_PropMap;
  14.  
  15. // Signal declaration
  16. void allDMXPropsReceived( unsigned long member, void* pData );
  17.  
  18.  
  19. // Create structure
  20. DevData* pDevData = new DevData();
  21. pDevData->nCounter = nPropTotal;
  22. pDevData->pData = static_cast<void*>( pNode );
  23.  
  24. m_PropMap.insert( GetPropertyEntry( handle, pDevData ) );
  25. .
  26. .
  27. .
  28. // Retreive the data pointer from the struct in the map
  29. GetPropertyMapIter mit = m_PropMap.find( member );
  30. if ( mit != m_PropMap.end() )
  31. {
  32. if ( mit->second != NULL )
  33. {
  34. ...
  35. if ( mit->second->pData != NULL )
  36. emit allDMXPropsReceived( member, mit->second->pData );
  37. ...
  38. }
  39. }
  40.  
  41.  
  42. //Slot declaration
  43. void SLOT_AllDMXPropsReceived( unsigned long u4member, void* pData );
  44.  
  45. // Slot connection
  46. connect( m_pController, SIGNAL( allDMXPropsReceived( unsigned long, void* ) ),
  47. this, SLOT( SLOT_AllDMXPropsReceived( unsigned long, void* ) ), Qt::QueuedConnection );
  48.  
  49.  
  50. void DMXTable::SLOT_AllDMXPropsReceived( unsigned long u4member, void* pData )
  51. {
  52. CDMXGateway* pNode = static_cast<CDMXGateway*>( pData );
  53.  
  54. // Access data & crash
  55. SetDeviceName( pNode->GetDeviceName() );
  56. SetIPAddr( pNode->GetIPAddr() );
  57. ...
To copy to clipboard, switch view to plain text mode