1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Smart Pointers: Add a new enum for indicating if a smart point should increment a reference count or not

This commit is contained in:
Anthony Nicholls 2025-09-22 17:34:34 +01:00 committed by Anthony Nicholls
parent 8931d45fe9
commit e68627c9ed
68 changed files with 243 additions and 160 deletions

View file

@ -122,7 +122,7 @@ class AccessibilityHandler::AccessibilityNativeImpl
{
public:
explicit AccessibilityNativeImpl (AccessibilityHandler& owner)
: accessibilityElement (becomeComSmartPtrOwner (new AccessibilityNativeHandle (owner)))
: accessibilityElement (new AccessibilityNativeHandle (owner), IncrementRef::no)
{
++providerCount;
}

View file

@ -40,7 +40,7 @@ class UIAProviderBase
{
public:
explicit UIAProviderBase (AccessibilityNativeHandle* nativeHandleIn)
: nativeHandle (addComSmartPtrOwner (nativeHandleIn))
: nativeHandle (nativeHandleIn, IncrementRef::yes)
{
}

View file

@ -194,7 +194,7 @@ private:
public:
UIATextRangeProvider (UIATextProvider& textProvider, Range<int> range)
: UIAProviderBase (textProvider.getHandler().getNativeImplementation()),
owner (addComSmartPtrOwner (&textProvider)),
owner (&textProvider, IncrementRef::yes),
selectionRange (range)
{
}

View file

@ -357,8 +357,8 @@ public:
static jobjectArray JNICALL contentSharerGetStreamTypes (JNIEnv*, jobject /*contentProvider*/, jobject uri, jstring mimeTypeFilter)
{
return getInstance().getStreamTypes (addLocalRefOwner (uri),
addLocalRefOwner (mimeTypeFilter));
return getInstance().getStreamTypes (LocalRef (uri, IncrementRef::yes),
LocalRef (mimeTypeFilter, IncrementRef::yes));
}
private:

View file

@ -296,7 +296,7 @@ private:
{
HWND hwnd = nullptr;
if (auto window = addComSmartPtrOwner (d).getInterface<IOleWindow>())
if (auto window = ComSmartPtr (d, IncrementRef::yes).getInterface<IOleWindow>())
window->GetWindow (&hwnd);
ScopedLock lock (owner.deletingDialog);