Click here to Skip to main content
15,895,256 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Numbering Puzzle in C++ Pin
Cedric Moonen17-Feb-06 2:47
Cedric Moonen17-Feb-06 2:47 
QuestionHow to understand the macro Base_Offset? Pin
uglystone17-Feb-06 0:53
uglystone17-Feb-06 0:53 
AnswerRe: How to understand the macro Base_Offset? Pin
toxcct17-Feb-06 4:28
toxcct17-Feb-06 4:28 
QuestionZOOM in PICTUREBOX Problem !!!!!!!! Pin
hbjs16-Feb-06 19:46
hbjs16-Feb-06 19:46 
QuestionNative Types outside assembly Pin
Kordzik16-Feb-06 12:57
Kordzik16-Feb-06 12:57 
AnswerRe: Native Types outside assembly Pin
George L. Jackson16-Feb-06 13:02
George L. Jackson16-Feb-06 13:02 
GeneralRe: Native Types outside assembly Pin
Kordzik17-Feb-06 7:59
Kordzik17-Feb-06 7:59 
QuestionCCmdTarget destructor asserts while destroying sink object... Pin
chervu16-Feb-06 8:30
chervu16-Feb-06 8:30 
Hello,

I have an MC++ class exposing a COM interface ISrv. MC++ class also has a source interface, ISrc.

ISrv has below method:
void AttachSink( [MarshalAs(UnManagedType::IUnknown)]Object* pSrcUnk,
Int32 *pError, Int32* pState);

I have MFC sink class (derived from CCmdTarget) and implements ISrc interface.
Native C++ application instantiates this sink class and passes the sink object to MC++ by calling above method.

During CTRL+C operation, when sink object is destroyed , CCmdTarget throws an assertion at line:
ASSERT(m_dwRef <= 1)

In the debugger I found m_dwRef as 3. If this call is commnented then the assertion doesn't fail.


Debugging info:
I kept some "cout" statements within Sink class in side overridden method, QueryInterface().
I observed that QI was called 3 times in excess when the above method was called in my native application.
Actually, I call QI only once (right after Sink object instantiation) to retrieve ISrc interface.
Therefore, I presumed that it may be CCW invoking QI those many times and incrementing reference count. Is this correct?

Can you please let me know how to get around this problem of incorrect reference count?
I observed this problem only when this method was called. I call many other methods of MC++ class. But those methods do not take pointer to IUnknown as their parameter.
Does CCW behave different when IUnknown * is marshalled.
Is it likely that it does auto increment of reference count?

PLEASE SEE: I called Marshal::ReleaseCOMObject() in MC++ class and it returned reference count as 1. However, during the destruction of Sink object, ASSERT still popsup.

Looking forward your response....
Thank you and best Regards,

-- modified at 14:44 Thursday 16th February, 2006
Questioncreating a student class Pin
civicrico2316-Feb-06 7:22
civicrico2316-Feb-06 7:22 
AnswerRe: creating a student class Pin
malharone16-Feb-06 7:36
malharone16-Feb-06 7:36 
QuestionLooking for help in program design Pin
ldsdbomber16-Feb-06 5:42
ldsdbomber16-Feb-06 5:42 
QuestionUndefined symbol Pin
Ed.Poore15-Feb-06 11:20
Ed.Poore15-Feb-06 11:20 
Question[Message Deleted] Pin
48d205815-Feb-06 4:59
48d205815-Feb-06 4:59 
AnswerRe: How to fix this bug? Pin
George L. Jackson15-Feb-06 12:49
George L. Jackson15-Feb-06 12:49 
QuestionUsing MemoryStream Pin
Daniel Odom14-Feb-06 11:28
Daniel Odom14-Feb-06 11:28 
AnswerRe: Using MemoryStream Pin
George L. Jackson15-Feb-06 12:56
George L. Jackson15-Feb-06 12:56 
QuestionSystem::Web::?? Pin
Ed K14-Feb-06 11:12
Ed K14-Feb-06 11:12 
AnswerRe: System::Web::?? Pin
George L. Jackson14-Feb-06 12:53
George L. Jackson14-Feb-06 12:53 
AnswerRe: System::Web::?? Pin
Ed K15-Feb-06 4:44
Ed K15-Feb-06 4:44 
GeneralRe: System::Web::?? Pin
George L. Jackson15-Feb-06 14:28
George L. Jackson15-Feb-06 14:28 
AnswerRe: System::Web::?? Pin
Ed K15-Feb-06 15:05
Ed K15-Feb-06 15:05 
GeneralRe: System::Web::?? Pin
George L. Jackson15-Feb-06 15:35
George L. Jackson15-Feb-06 15:35 
GeneralRe: System::Web::?? Pin
George L. Jackson15-Feb-06 16:05
George L. Jackson15-Feb-06 16:05 
GeneralRe: System::Web::?? Pin
Ed K16-Feb-06 10:15
Ed K16-Feb-06 10:15 
GeneralRe: System::Web::?? Pin
George L. Jackson16-Feb-06 11:17
George L. Jackson16-Feb-06 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.