wasm: don’t leak QWasmScreen member variables
m_compositor and m_eventTranslator are owned by the screen object and can be held in a unique_ptr. Pick-to: 6.2 Change-Id: I7d5e19e7ac6f762f360d6af0fc9500e6964f737e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
a6bd2da2ab
commit
0ca0f3e7fe
@ -54,9 +54,9 @@ const char * QWasmScreen::m_canvasResizeObserverCallbackContextPropertyName = "d
|
||||
|
||||
QWasmScreen::QWasmScreen(const emscripten::val &canvas)
|
||||
: m_canvas(canvas)
|
||||
, m_compositor(new QWasmCompositor(this))
|
||||
, m_eventTranslator(new QWasmEventTranslator(this))
|
||||
{
|
||||
m_compositor = new QWasmCompositor(this);
|
||||
m_eventTranslator = new QWasmEventTranslator(this);
|
||||
updateQScreenAndCanvasRenderSize();
|
||||
m_canvas.call<void>("focus");
|
||||
}
|
||||
@ -84,12 +84,12 @@ QWasmScreen *QWasmScreen::get(QScreen *screen)
|
||||
|
||||
QWasmCompositor *QWasmScreen::compositor()
|
||||
{
|
||||
return m_compositor;
|
||||
return m_compositor.get();
|
||||
}
|
||||
|
||||
QWasmEventTranslator *QWasmScreen::eventTranslator()
|
||||
{
|
||||
return m_eventTranslator;
|
||||
return m_eventTranslator.get();
|
||||
}
|
||||
|
||||
emscripten::val QWasmScreen::canvas() const
|
||||
|
@ -86,8 +86,8 @@ public slots:
|
||||
|
||||
private:
|
||||
emscripten::val m_canvas;
|
||||
QWasmCompositor *m_compositor = nullptr;
|
||||
QWasmEventTranslator *m_eventTranslator = nullptr;
|
||||
std::unique_ptr<QWasmCompositor> m_compositor;
|
||||
std::unique_ptr<QWasmEventTranslator> m_eventTranslator;
|
||||
QRect m_geometry = QRect(0, 0, 100, 100);
|
||||
int m_depth = 32;
|
||||
QImage::Format m_format = QImage::Format_RGB32;
|
||||
|
Loading…
Reference in New Issue
Block a user