Skip to content

Commit 9b70a8c

Browse files
Merge pull request #15843 from RomanPudashkin/update_4.0.1
update_4.0.1
2 parents 76500c3 + 7273044 commit 9b70a8c

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

src/engraving/libmscore/edit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5144,6 +5144,8 @@ void Score::undoRemoveStaff(Staff* staff)
51445144

51455145
staff->undoUnlink();
51465146

5147+
mu::remove_if(systemObjectStaves, [staff](Staff* s){ return s == staff; });
5148+
51475149
undo(new RemoveStaff(staff));
51485150
}
51495151

src/framework/vst/internal/vstaudioclient.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,11 @@ void VstAudioClient::extractInputSamples(const audio::samples_t& sampleCount, co
316316
return;
317317
}
318318

319+
Steinberg::Vst::AudioBusBuffers& bus = m_processData.inputs[0];
320+
319321
for (unsigned int i = 0; i < sampleCount; ++i) {
320-
for (audio::audioch_t s = 0; s < m_audioChannelsCount; ++s) {
321-
m_processData.inputs[0].channelBuffers32[s][i] = sourceBuffer[i * m_audioChannelsCount + s];
322+
for (audio::audioch_t s = 0; s < bus.numChannels; ++s) {
323+
bus.channelBuffers32[s][i] = sourceBuffer[i * m_audioChannelsCount + s];
322324
}
323325
}
324326
}

src/framework/vst/internal/vstmodulesrepository.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void VstModulesRepository::removePluginModule(const audio::AudioResourceId& reso
110110
std::lock_guard lock(m_mutex);
111111

112112
auto search = m_modules.find(resourceId);
113-
if (search != m_modules.end()) {
113+
if (search == m_modules.end()) {
114114
return;
115115
}
116116

src/framework/vst/internal/vstplugin.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ void VstPlugin::unload()
125125
m_module = nullptr;
126126
m_pluginProvider = nullptr;
127127
m_classInfo = ClassInfo();
128-
m_pluginView = nullptr;
129128
m_isLoaded = false;
130129
m_unloadingCompleted.notify();
131130
}, threadSecurer()->mainThreadId());
@@ -176,25 +175,18 @@ void VstPlugin::stateBufferFromString(VstMemoryStream& buffer, char* strData, co
176175
buffer.seek(0, Steinberg::IBStream::kIBSeekSet, nullptr);
177176
}
178177

179-
PluginViewPtr VstPlugin::view() const
178+
PluginViewPtr VstPlugin::createView() const
180179
{
181180
ONLY_MAIN_THREAD(threadSecurer);
182181

183182
std::lock_guard lock(m_mutex);
184183

185-
if (m_pluginView) {
186-
return m_pluginView;
187-
}
188-
189184
auto controller = m_pluginProvider->getController();
190-
191185
if (!controller) {
192186
return nullptr;
193187
}
194188

195-
m_pluginView = owned(controller->createView(PluginEditorViewType::kEditor));
196-
197-
return m_pluginView;
189+
return owned(controller->createView(PluginEditorViewType::kEditor));
198190
}
199191

200192
PluginProviderPtr VstPlugin::provider() const

src/framework/vst/internal/vstplugin.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class VstPlugin : public async::Asyncable
5151
const audio::AudioResourceId& resourceId() const;
5252
const std::string& name() const;
5353

54-
PluginViewPtr view() const;
54+
PluginViewPtr createView() const;
5555
PluginProviderPtr provider() const;
5656
bool isAbleForInput() const;
5757

@@ -77,7 +77,6 @@ class VstPlugin : public async::Asyncable
7777

7878
PluginModulePtr m_module = nullptr;
7979
PluginProviderPtr m_pluginProvider = nullptr;
80-
mutable PluginViewPtr m_pluginView = nullptr;
8180
ClassInfo m_classInfo;
8281

8382
Steinberg::FUnknownPtr<VstComponentHandler> m_componentHandlerPtr = nullptr;

src/framework/vst/view/abstractvsteditorview.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,22 @@ AbstractVstEditorView::AbstractVstEditorView(QWidget* parent)
5858
}
5959

6060
AbstractVstEditorView::~AbstractVstEditorView()
61+
{
62+
deinit();
63+
}
64+
65+
void AbstractVstEditorView::deinit()
6166
{
6267
if (m_view) {
6368
m_view->setFrame(nullptr);
6469
m_view->removed();
70+
m_view = nullptr;
6571
}
6672

6773
if (m_pluginPtr) {
6874
m_pluginPtr->loadingCompleted().resetOnNotify(this);
6975
m_pluginPtr->refreshConfig();
76+
m_pluginPtr = nullptr;
7077
}
7178
}
7279

@@ -108,11 +115,14 @@ void AbstractVstEditorView::wrapPluginView()
108115

109116
void AbstractVstEditorView::attachView(VstPluginPtr pluginPtr)
110117
{
111-
if (!pluginPtr || !pluginPtr->view()) {
118+
if (!pluginPtr) {
112119
return;
113120
}
114121

115-
m_view = pluginPtr->view();
122+
m_view = pluginPtr->createView();
123+
if (!m_view) {
124+
return;
125+
}
116126

117127
if (m_view->isPlatformTypeSupported(currentPlatformUiType()) != Steinberg::kResultTrue) {
118128
return;
@@ -165,6 +175,13 @@ void AbstractVstEditorView::showEvent(QShowEvent* ev)
165175
TopLevelDialog::showEvent(ev);
166176
}
167177

178+
void AbstractVstEditorView::closeEvent(QCloseEvent* ev)
179+
{
180+
deinit();
181+
182+
TopLevelDialog::closeEvent(ev);
183+
}
184+
168185
bool AbstractVstEditorView::event(QEvent* ev)
169186
{
170187
if (ev && ev->spontaneous() && ev->type() == QEvent::ShortcutOverride) {

src/framework/vst/view/abstractvsteditorview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ class AbstractVstEditorView : public uicomponents::TopLevelDialog, public Steinb
7474
void moveViewToMainWindowCenter();
7575

7676
void showEvent(QShowEvent* ev) override;
77+
void closeEvent(QCloseEvent* ev) override;
7778
bool event(QEvent* ev) override;
7879

80+
void deinit();
81+
7982
FIDString currentPlatformUiType() const;
8083

8184
VstPluginPtr m_pluginPtr = nullptr;

0 commit comments

Comments
 (0)