1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

ComSmartPtr: Make ownership more explicit

COM objects now always start with a refcount of 1, as is convention.
This commit is contained in:
reuk 2024-03-21 19:27:48 +00:00
parent fe9fc0c0e6
commit 1f9ba0682c
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
12 changed files with 78 additions and 47 deletions

View file

@ -111,7 +111,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
sampleGrabber->SetMediaType (&mt);
}
callback = new GrabberCallback (*this);
callback = becomeComSmartPtrOwner (new GrabberCallback (*this));
hr = sampleGrabber->SetCallback (callback, 1);
hr = graphBuilder->AddFilter (sampleGrabberBase, _T ("Sample Grabber"));
@ -536,8 +536,8 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
struct GrabberCallback : public ComBaseClassHelperBase<ComTypes::ISampleGrabberCB>
{
GrabberCallback (Pimpl& p)
: ComBaseClassHelperBase (0), owner (p) {}
explicit GrabberCallback (Pimpl& p)
: owner (p) {}
JUCE_COMRESULT QueryInterface (REFIID refId, void** result) override
{