Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Strange ROT behavior question

Strange ROT behavior question

Scheduled Pinned Locked Moved COM
questioncomperformancehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vipsy
    wrote on last edited by
    #1

    Hi all, Currently I'm writing two plugins for Windows Media Player. One plugin is DSP processor and the other - Visualisation. I need my plugins can communicate with each other though COM interfaces. So I create my own moniker class to register one of the objects in ROT. When my DSP pluging object is constructed I create moniker in the FinalConstruct (constructor) and register my object in ROT with ROTFLAGS_REGISTRATIONKEEPSALIVE flag. Later when my vis plugin needs to communicate with DSP plugin it also create moniker and binds it to DSP plugin - all works ok. But I cannot understand WHY when Win MediaPlayer releases my DSP plugin the plugin is destructed ? I mean that ROT also releases the pointer to my DSP plugin. Actually that is what I really need, but from docs I would expect different behavior - I suppose that ROT holds "strong" (I wonder where the explanation this term) reference to my DSP plugin so it will remain in memory until Revoke ? Also when I remove ROTFLAGS_REGISTRATIONKEEPSALIVE flag in IRunningObjectTable::Register method call my moniker cannot bind to object. Short description on the object which being registered in ROT: HRESULT DSPPlug::FinalContruct() { CComPtr p = CreateMoniker(); ... CComPtr pIROT; ::GetRunningObjectTable(NULL,&pIROT); ... pIROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE,this,p,&this->ROTRegValue); } void DSPPlug::FinalRelease() { CComPtr pIROT; ::GetRunningObjectTable(NULL,&pIROT); ... pIROT->Revoke(this->ROTRegValue); } Can someone help with explanation of those ? Best regards, Valery

    J 1 Reply Last reply
    0
    • V vipsy

      Hi all, Currently I'm writing two plugins for Windows Media Player. One plugin is DSP processor and the other - Visualisation. I need my plugins can communicate with each other though COM interfaces. So I create my own moniker class to register one of the objects in ROT. When my DSP pluging object is constructed I create moniker in the FinalConstruct (constructor) and register my object in ROT with ROTFLAGS_REGISTRATIONKEEPSALIVE flag. Later when my vis plugin needs to communicate with DSP plugin it also create moniker and binds it to DSP plugin - all works ok. But I cannot understand WHY when Win MediaPlayer releases my DSP plugin the plugin is destructed ? I mean that ROT also releases the pointer to my DSP plugin. Actually that is what I really need, but from docs I would expect different behavior - I suppose that ROT holds "strong" (I wonder where the explanation this term) reference to my DSP plugin so it will remain in memory until Revoke ? Also when I remove ROTFLAGS_REGISTRATIONKEEPSALIVE flag in IRunningObjectTable::Register method call my moniker cannot bind to object. Short description on the object which being registered in ROT: HRESULT DSPPlug::FinalContruct() { CComPtr p = CreateMoniker(); ... CComPtr pIROT; ::GetRunningObjectTable(NULL,&pIROT); ... pIROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE,this,p,&this->ROTRegValue); } void DSPPlug::FinalRelease() { CComPtr pIROT; ::GetRunningObjectTable(NULL,&pIROT); ... pIROT->Revoke(this->ROTRegValue); } Can someone help with explanation of those ? Best regards, Valery

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      I am as clueless as you about your problem. Would RegisterActiveObject() work for you? I don't think revoking the ROT entry to yourself i FinalRelease() is a good idea. There's a cyclic reference there. The ROT has a reference to you, and you have a reference to it. Surely, there must be a better time to release yourself...? -- Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr. Welle: Erdball - F104-G Starfighter

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups