diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-09 12:00:59 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-28 10:50:39 +0100 |
commit | 8b71ea32134b2eeff2a69f1113744bc11a14c6b3 (patch) | |
tree | 96b6d7e579b92c87b9c4ffde290ed5a0e3088d49 /vcl/jsdialog/jsdialogbuilder.cxx | |
parent | 4144717f3e02f6c1d8fe48fce7d26950413ad44b (diff) |
jsdialog: properly destroy JsonWriter
Change-Id: Ic9bc13b60284ece25b6c72326fd2185d14e17029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107466
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl/jsdialog/jsdialogbuilder.cxx')
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 50954dcec727..0b439f57e2f3 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -40,21 +40,28 @@ JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, void JSDialogNotifyIdle::ForceUpdate() { m_bForce = true; } -void JSDialogNotifyIdle::send(std::unique_ptr<tools::JsonWriter> aJsonWriter) +void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter) { if (!m_aNotifierWindow) + { + free(aJsonWriter.extractData()); return; + } const vcl::ILibreOfficeKitNotifier* pNotifier = m_aNotifierWindow->GetLOKNotifier(); if (pNotifier) { - if (m_bForce || !aJsonWriter->isDataEquals(m_LastNotificationMessage)) + if (m_bForce || !aJsonWriter.isDataEquals(m_LastNotificationMessage)) { m_bForce = false; - m_LastNotificationMessage = aJsonWriter->extractAsStdString(); + m_LastNotificationMessage = aJsonWriter.extractAsStdString(); pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, m_LastNotificationMessage.c_str()); } + else + { + free(aJsonWriter.extractData()); + } } } @@ -101,9 +108,9 @@ std::unique_ptr<tools::JsonWriter> JSDialogNotifyIdle::generateCloseMessage() co return aJsonWriter; } -void JSDialogNotifyIdle::Invoke() { send(dumpStatus()); } +void JSDialogNotifyIdle::Invoke() { send(*dumpStatus()); } -void JSDialogNotifyIdle::sendClose() { send(generateCloseMessage()); } +void JSDialogNotifyIdle::sendClose() { send(*generateCloseMessage()); } void JSDialogSender::notifyDialogState(bool bForce) { |