Share via

Bugs in Direct-composition

RSJ 1 Reputation point
2021-07-02T08:39:55.343+00:00
  1. Reference count in "IDCompositionVisual3" unexpectedly get increased by one with "DCompositionAttachMouseDragToHwnd". And It never get released automatically from anywhere. so currently i release the refcount manually after when i called "DCompositionAttachMouseDragToHwnd".
  2. Can not release instance of "IDCompositionDesktopDevice" properly without instance of "IDCompositionTarget". IDCompositionDesktopDevice::CreateVisual increases refcount by 2 in IDCompositionDesktopDevice object. And You may not release this object properly unless you have an instance of "IDCompositionTarget" created by that device object, And you have to release it before releasing IDCompositionDesktopDevice. You know you might not need a target for a device. and neither did i. But now i have realized i have to create a "target" object to release device object even if i don't need it.
Windows development | Windows API - Win32
0 comments No comments

2 answers

Sort by: Most helpful
  1. RSJ 1 Reputation point
    2021-07-05T14:02:18.427+00:00

    Sorry for wrong information of the refcount. but It's not important how many refcount is increasing by CreateVisual. The weird thing is you have to create and release target before releasing device. even if you don't need own target object for the device object.

    Was this answer helpful?

    0 comments No comments

  2. Xiaopo Yang - MSFT 12,736 Reputation points Microsoft External Staff
    2021-07-05T07:25:23.26+00:00

    Q1: DCompositionAttachMouseDragToHwnd does increase refcount by 1. So It's needed to release manually.
    Q2: With testing the Return Value Of Release on IDCompositionDesktopDevice and IDCompositionVisual2, I found IDCompositionDesktopDevice::CreateVisual increases refcount by 1 in IDCompositionDesktopDevice object. Perhaps your Code somewhere capture extra the reference count 1.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.