mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
InAppPurchasesDemo: Fix leaky ListBoxModel implementation
This commit is contained in:
parent
4cf74dfff6
commit
4a7b556463
1 changed files with 6 additions and 4 deletions
|
|
@ -442,15 +442,17 @@ public:
|
|||
|
||||
Component* refreshComponentForRow (int row, bool selected, Component* existing) override
|
||||
{
|
||||
auto safePtr = rawToUniquePtr (existing);
|
||||
|
||||
if (isPositiveAndBelow (row, voiceProducts.size()))
|
||||
{
|
||||
if (existing == nullptr)
|
||||
existing = new VoiceRow (purchases);
|
||||
if (safePtr == nullptr)
|
||||
safePtr = std::make_unique<VoiceRow> (purchases);
|
||||
|
||||
if (auto* voiceRow = dynamic_cast<VoiceRow*> (existing))
|
||||
if (auto* voiceRow = dynamic_cast<VoiceRow*> (safePtr.get()))
|
||||
voiceRow->update (row, selected);
|
||||
|
||||
return existing;
|
||||
return safePtr.release();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue