Skip to content

Commit

Permalink
remove multi editing support in link, weakReference compil fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Jun 16, 2024
1 parent a983709 commit f3ee247
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Source/Common/ParameterLink/ParameterLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class ParameterLink :

DECLARE_ASYNC_EVENT(ParameterLink, ParameterLink, paramLink, ENUM_LIST(LINK_UPDATED, PREVIEW_UPDATED, INPUT_VALUE_UPDATED, LIST_ITEM_UPDATED), !isLinkBeingDestroyed)

juce::WeakReference<Inspectable>::Master masterReference;
juce::WeakReference<ParameterLink>::Master masterReference;

};

Expand Down
26 changes: 13 additions & 13 deletions Source/Common/ParameterLink/ui/LinkableParameterEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ LinkableParameterEditor::LinkableParameterEditor(Array<ParameterLink*> pLinks, b
link(pLinks.size() > 0 ? pLinks[0] : nullptr)

{
for (auto& i : inspectables) links.add(dynamic_cast<ParameterLink*>(i.get()));
//for (auto& i : inspectables) links.add(dynamic_cast<ParameterLink*>(i.get()));

if (link == nullptr) return;

for (auto& l : links)
{
l->addAsyncParameterLinkListener(this);
}
link->addAsyncParameterLinkListener(this);
//for (auto& l : links)
//{
//}

linkBT.reset(AssetManager::getInstance()->getToggleBTImage(ChataigneAssetManager::getInstance()->linkOnImage));
linkBT->addListener(this);
Expand All @@ -45,14 +45,14 @@ LinkableParameterEditor::LinkableParameterEditor(Array<ParameterLink*> pLinks, b

LinkableParameterEditor::~LinkableParameterEditor()
{
if (link == nullptr || link.wasObjectDeleted()) return;
if (inspectable.wasObjectDeleted() || paramEditor->parameter == nullptr || paramEditor->parameter.wasObjectDeleted()) return;

for (int i = 0; i < links.size(); i++)
{
if (links[i] == nullptr || inspectables[i] == nullptr || inspectables[i].wasObjectDeleted()) continue;
if (links[i]->isLinkBeingDestroyed) links[i]->removeAsyncParameterLinkListener(this);
}
if (link == nullptr || link.wasObjectDeleted() || inspectable.wasObjectDeleted()) return;
link->removeAsyncParameterLinkListener(this);

//for (int i = 0; i < links.size(); i++)
//{
// if (links[i] == nullptr || inspectables[i] == nullptr || inspectables[i].wasObjectDeleted()) continue;
// if (links[i]->isLinkBeingDestroyed) links[i]->removeAsyncParameterLinkListener(this);
//}
}

void LinkableParameterEditor::paint(Graphics& g)
Expand Down
2 changes: 1 addition & 1 deletion Source/Common/ParameterLink/ui/LinkableParameterEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LinkableParameterEditor :
bool showMappingOptions;


Array<WeakReference<ParameterLink>> links;
//Array<WeakReference<ParameterLink>> links;
WeakReference<ParameterLink> link;
std::unique_ptr<ParameterEditor> paramEditor;
std::unique_ptr<ImageButton> linkBT;
Expand Down

0 comments on commit f3ee247

Please sign in to comment.