Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-35286

IEnumConnections->Clone method makes a clone that crashes in its Next method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 5.2.1
    • 5.1.1
    • ActiveX Support
    • None
    • Win32, VS2012
    • qtactiveqt: 0d29579baffd4f31a3ec39590117f4fee821694d (5.2.1, stable, 9.12.2013) Qt: 4: 3bef845f4623e0edcd52ddcffee3612f4f7f6779 (20.12.2013, 4.8.6)

      IEnumConnections->Clone method makes a clone that crashes in its Next method
      even though the original enumerator works (only after calling the Reset method as a workaround for it's own crash)

      void crash3( IQTCrashPtr qtObject )
      {
      	IConnectionPointPtr connectionPoint;
      	IConnectionPointContainerPtr( qtObject )->FindConnectionPoint( __uuidof( IQTCrashEvents ), &connectionPoint );
      	
      	IEnumConnectionsPtr connections;
      	connectionPoint->EnumConnections( &connections );
      	connections->Reset();
      
      	IEnumConnectionsPtr connectionsClone;
      	connections->Clone( &connectionsClone );
      
      	// original enumerator is OK after calling Reset method
      	{
      		DWORD fetched;
      		CONNECTDATA connectionData = { 0, 0 };
      		while( connections->Next( 1, &connectionData, &fetched ) == S_OK) 
      		{
      			if( connectionData.pUnk )
      				connectionData.pUnk->Release();
      		}
      	}
      
      	// clone is broken
      	{
      		DWORD fetched;
      		CONNECTDATA connectionData = { 0, 0 };
      		while( connectionsClone->Next( 1, &connectionData, &fetched ) == S_OK) // crash here
      		{
      			if( connectionData.pUnk )
      				connectionData.pUnk->Release();
      		}
      	}
      }
      

      Example project demonstrating the error is attached

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kleint Friedemann Kleint
            sbk Sergey Korepanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes