Skip to content

Commit

Permalink
VST: Don't keep a resource map open on macOS
Browse files Browse the repository at this point in the history
To my best belief, I believe this was only kept around when we still had
support for Carbon-based VSTs. Since support for them was removed, this
step appears to be unnecessary and also appeared to be a hack for
Carbon-based VSTs anyway.

Signed-off-by: Avery King <avery98@pm.me>
  • Loading branch information
generic-pers0n committed Sep 14, 2024
1 parent 9c936e3 commit 51a3484
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 55 deletions.
19 changes: 0 additions & 19 deletions src/effects/VST/VSTEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1985,11 +1985,6 @@ bool VSTEffect::Load()
mAEffect = NULL;

#if defined(__WXMAC__)
// Start clean
mBundleRef.reset();

mResource = ResourceHandle{};

// Convert the path to a CFSTring
wxCFStringRef path(realPath);

Expand Down Expand Up @@ -2053,15 +2048,6 @@ bool VSTEffect::Load()
return false;
}

// Need to keep the bundle reference around so we can map the
// resources.
mBundleRef = std::move(bundleRef);

// Open the resource map ... some plugins (like GRM Tools) need this.
mResource = ResourceHandle{
mBundleRef.get(), CFBundleOpenBundleResourceMap(mBundleRef.get())
};

#elif defined(__WXMSW__)

{
Expand Down Expand Up @@ -2261,11 +2247,6 @@ void VSTEffect::Unload()

if (mModule)
{
#if defined(__WXMAC__)
mResource.reset();
mBundleRef.reset();
#endif

mModule.reset();
mAEffect = NULL;
}
Expand Down
36 changes: 0 additions & 36 deletions src/effects/VST/VSTEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,42 +298,6 @@ class VSTEffect final : public wxEvtHandler,

ModuleHandle mModule;

#if defined(__WXMAC__)
// These members must be ordered after mModule

struct BundleDeleter {
void operator() (void*) const;
};
using BundleHandle = std::unique_ptr<
__CFBundle, BundleDeleter
>;

BundleHandle mBundleRef;

struct ResourceHandle {
ResourceHandle(
CFBundleRef pHandle = nullptr, CFBundleRefNum num = 0)
: mpHandle{ pHandle }, mNum{ num }
{}
ResourceHandle& operator=( ResourceHandle &&other )
{
if (this != &other) {
mpHandle = other.mpHandle;
mNum = other.mNum;
other.mpHandle = nullptr;
other.mNum = 0;
}
return *this;
}
~ResourceHandle() { reset(); }
void reset();

CFBundleRef mpHandle{};
CFBundleRefNum mNum{};
};
ResourceHandle mResource;
#endif

AEffect *mAEffect;

VstTimeInfo mTimeInfo;
Expand Down

0 comments on commit 51a3484

Please sign in to comment.