Advertisement

09.10.2008 at 10:25AM PDT, ID: 23720155
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

Crash during CoUninitialize seemingly due to my event sink

Asked by povjetset in Windows ATL / WTL / COM Programming, C++ Programming Language

Tags:

The crash (developing/running on Vista, using COM without ATL/MFC) appears to be during CoUninitialize (at some point after the event sink object gets deleted):

First-chance exception at 0x7783cb3f (oleaut32.dll) in myapp.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
First-chance exception at 0x75f242eb (kernel32.dll) in myapp.exe: 0x80010108: The object invoked has disconnected from its clients.

At startup, I connect to a local out-of-process com automation server, and create an event sink which I Advise() to the com server.

When my app is exiting, I:
"      UnAdvise() my sink
"      Release() my sink (the refcount is 3 when entering this function)
"      Release() the smart com object pointer
"      CoUninitialize()

If I comment out my event sink (i.e. never create it), then I dont get the crash.
Or, if I artificially bump up the refcount on my sink object by 1 so it doesnt get deleted, the crash still happens

The stack looks something like this:
                ntdll.dll!_DbgBreakPoint@0()    
                ntdll.dll!_RtlReportException@12()  + 0x51 bytes              
                ole32.dll!SilentlyReportExceptions()  + 0x79 bytes            
                ole32.dll!ServerExceptionFilter()  + 0x24 bytes  
                ole32.dll!AppInvokeExceptionFilterWithMethodAddress()  + 0x11 bytes              
                ole32.dll!AppInvokeExceptionFilter()  + 0x1a bytes          
                ole32.dll!FinishShutdown()  + 0x3692b bytes      
                msvcrt.dll!@_EH4_CallFilterFunc@8()  + 0x12 bytes        
                msvcrt.dll!__except_handler4_common()  + 0x87 bytes              
                ole32.dll!__except_handler4()  + 0x20 bytes      
                ntdll.dll!ExecuteHandler2@20()  + 0x26 bytes    
                ntdll.dll!ExecuteHandler@20()  + 0x24 bytes      
                ntdll.dll!_KiUserExceptionDispatcher@8()  + 0xf bytes  
                oleaut32.dll!CStubWrapper::Disconnect()  + 0x25 bytes
                ole32.dll!CStdMarshal::DisconnectSrvIPIDs()  + 0xcd bytes          
                ole32.dll!CStdMarshal::Disconnect()  - 0x4a77 bytes        
                ole32.dll!DisconnectSwitch()  + 0x16 bytes          
                ole32.dll!CStdMarshal::DisconnectAndRelease()  + 0x2e bytes  
                ole32.dll!COIDTable::ThreadCleanup()  - 0x27b8b bytes
                ole32.dll!FinishShutdown()  + 0x40 bytes              
                ole32.dll!ApartmentUninitialize()  + 0x58 bytes  
                ole32.dll!wCoUninitialize()  - 0x13953 bytes        
                ole32.dll!_CoUninitialize@0()  + 0x1b2 bytes      
                myapp.exe!CHsw::Close()  Line 134 + 0x8 bytes               C++Start Free Trial
 
 
[+][-]09.13.2008 at 03:15AM PDT, ID: 22466410

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.13.2008 at 07:35AM PDT, ID: 22467689

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows ATL / WTL / COM Programming, C++ Programming Language
Tags: c++
Sign Up Now!
Solution Provided By: povjetset
Participating Experts: 0
Solution Grade: A
 
 
 
Loading Advertisement...
20081119-EE-VQP-49 / EE_QW_2_20070628