summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-19 15:11:03 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-11 10:12:46 +0000
commitaf32996eb55008b9787516a280a237b61a05ca05 (patch)
tree62aab941be89dc628b4c9c8ee1fd6b7ecea03acd /libreofficekit
parent699b5e361d1f75b1414a351dfe4d05d88e2b49e2 (diff)
coverity#1343633 Resource leak
Change-Id: I2384091557c2a3b061e2c60118309f35b65b45d6 (cherry picked from commit 746da6b7fb3829e1ca23a4b8dfec6c502bac681c) Reviewed-on: https://gerrit.libreoffice.org/21270 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 918f292b460f..426773cd4d30 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -335,6 +335,9 @@ static void
doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highlightAll)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
+ if (!priv->m_pDocument)
+ return;
+
boost::property_tree::ptree aTree;
GtkWidget* drawingWidget = GTK_WIDGET(pDocView);
GdkWindow* drawingWindow = gtk_widget_get_window(drawingWidget);
@@ -342,9 +345,6 @@ doSearch(LOKDocView* pDocView, const char* pText, bool bBackwards, bool highligh
cairo_rectangle_int_t cairoVisRect;
int x, y;
- if (!priv->m_pDocument)
- return;
-
cairo_region_get_rectangle(cairoVisRegion, 0, &cairoVisRect);
x = pixelToTwip (cairoVisRect.x, priv->m_fZoom);
y = pixelToTwip (cairoVisRect.y, priv->m_fZoom);
@@ -2543,13 +2543,13 @@ SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_part (LOKDocView* pDocView, int nPart)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
+ if (!priv->m_pDocument)
+ return;
+
GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
LOEvent* pLOEvent = new LOEvent(LOK_SET_PART);
GError* error = nullptr;
- if (!priv->m_pDocument)
- return;
-
pLOEvent->m_nPart = nPart;
g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
@@ -2566,7 +2566,6 @@ SAL_DLLPUBLIC_EXPORT gchar*
lok_doc_view_get_part_name (LOKDocView* pDocView, int nPart)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
-
if (!priv->m_pDocument)
return nullptr;
@@ -2682,7 +2681,6 @@ lok_doc_view_post_command (LOKDocView* pDocView,
gboolean bNotifyWhenFinished)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);
-
if (!priv->m_pDocument)
return;