Commit 05a64029 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix cloning vector layers

For all internal vector updates we should use safe signal
compressor instead of the regular one. Otherwise "timers
are accesses from non-gui thread" problem will chase us :)

BUG:408028
parent 6c643ebc
......@@ -72,9 +72,10 @@ public:
KisSignalCompressor(int delay, Mode mode, QObject *parent = 0);
bool isActive() const;
void setMode(Mode mode);
void setDelay(int delay);
public Q_SLOTS:
void setDelay(int delay);
void start();
void stop();
......
......@@ -26,6 +26,7 @@ KisThreadSafeSignalCompressor::KisThreadSafeSignalCompressor(int delay, KisSigna
{
connect(this, SIGNAL(internalRequestSignal()), m_compressor, SLOT(start()), Qt::AutoConnection);
connect(this, SIGNAL(internalStopSignal()), m_compressor, SLOT(stop()), Qt::AutoConnection);
connect(this, SIGNAL(internalSetDelay(int)), m_compressor, SLOT(setDelay(int)), Qt::AutoConnection);
connect(m_compressor, SIGNAL(timeout()), SIGNAL(timeout()));
// due to this line the object *must not* be deleted explicitly!
......@@ -38,6 +39,11 @@ bool KisThreadSafeSignalCompressor::isActive() const
return m_compressor->isActive();
}
void KisThreadSafeSignalCompressor::setDelay(int delay)
{
emit internalSetDelay(delay);
}
void KisThreadSafeSignalCompressor::start()
{
emit internalRequestSignal();
......
......@@ -45,6 +45,7 @@ public:
bool isActive() const;
public Q_SLOTS:
void setDelay(int delay);
void start();
void stop();
......@@ -52,6 +53,7 @@ Q_SIGNALS:
void timeout();
void internalRequestSignal();
void internalStopSignal();
void internalSetDelay(int delay);
private:
KisSignalCompressor *m_compressor;
......
......@@ -35,7 +35,6 @@ class KUndo2Command;
class QWidget;
class KoUnit;
class KisImageViewConverter;
class KisSignalCompressor;
class KisShapeLayerCanvasBase : public KoCanvasBase
......@@ -124,7 +123,7 @@ private:
private:
KisPaintDeviceSP m_projection;
KisShapeLayer *m_parentLayer {0};
KisSignalCompressor m_canvasUpdateCompressor;
KisThreadSafeSignalCompressor m_canvasUpdateCompressor;
KisThreadSafeSignalCompressor m_asyncUpdateSignalCompressor;
volatile bool m_hasUpdateInCompressor = false;
......
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