Commit 6d1b7131 authored by Dmitry Kazakov's avatar Dmitry Kazakov

(Probably) fix a crash caused by not detaching progress proxy on view removal

Also fix duplicated signals problem caused by adding the proxies twice

BUG:352918
parent 417f3967
......@@ -18,17 +18,24 @@
#include "kis_composite_progress_proxy.h"
#include "kis_debug.h"
void KisCompositeProgressProxy::addProxy(KoProgressProxy *proxy)
{
m_proxies.append(proxy);
if (!m_uniqueProxies.contains(proxy)) {
m_uniqueProxies.append(proxy);
}
}
void KisCompositeProgressProxy::removeProxy(KoProgressProxy *proxy)
{
m_proxies.removeAll(proxy);
m_proxies.removeOne(proxy);
if (!m_proxies.contains(proxy)) {
m_uniqueProxies.removeOne(proxy);
}
}
int KisCompositeProgressProxy::maximum() const
{
if(m_proxies.isEmpty()) return 0;
......@@ -38,21 +45,21 @@ int KisCompositeProgressProxy::maximum() const
void KisCompositeProgressProxy::setValue(int value)
{
foreach(KoProgressProxy *proxy, m_proxies) {
foreach(KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setValue(value);
}
}
void KisCompositeProgressProxy::setRange(int minimum, int maximum)
{
foreach(KoProgressProxy *proxy, m_proxies) {
foreach(KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setRange(minimum, maximum);
}
}
void KisCompositeProgressProxy::setFormat(const QString &format)
{
foreach(KoProgressProxy *proxy, m_proxies) {
foreach(KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setFormat(format);
}
}
......
......@@ -37,6 +37,7 @@ public:
private:
QList<KoProgressProxy*> m_proxies;
QList<KoProgressProxy*> m_uniqueProxies;
};
#endif /* __KIS_COMPOSITE_PROGRESS_PROXY_H */
......@@ -257,6 +257,11 @@ KisView::KisView(KisDocument *document, KoCanvasResourceManager *resourceManager
KisView::~KisView()
{
if (d->viewManager) {
KoProgressProxy *proxy = d->viewManager->statusBar()->progress()->progressProxy();
KIS_ASSERT_RECOVER_NOOP(proxy);
image()->compositeProgressProxy()->removeProxy(proxy);
}
if (d->viewManager->filterManager()->isStrokeRunning()) {
d->viewManager->filterManager()->cancel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment