[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 28 09:51:22 UTC 2020
vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 +-
vcl/jsdialog/jsdialogbuilder.cxx | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 8b71ea32134b2eeff2a69f1113744bc11a14c6b3
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 9 12:00:59 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Dec 28 10:50:39 2020 +0100
jsdialog: properly destroy JsonWriter
Change-Id: Ic9bc13b60284ece25b6c72326fd2185d14e17029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107466
Tested-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 14090f43a0e4..556e34ffd346 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -52,7 +52,7 @@ public:
VclPtr<vcl::Window> getNotifierWindow() { return m_aNotifierWindow; }
private:
- void send(std::unique_ptr<tools::JsonWriter> aJsonWriter);
+ void send(tools::JsonWriter& aJsonWriter);
std::unique_ptr<tools::JsonWriter> dumpStatus() const;
std::unique_ptr<tools::JsonWriter> generateCloseMessage() const;
};
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)
{
More information about the Libreoffice-commits
mailing list