[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Oct 13 18:43:42 UTC 2016


 vcl/unx/gtk/gtkprintwrapper.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit bb51869d5fd339703767e1e70c832a803dd981eb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 13 14:29:15 2016 +0100

    Resolves: tdf#102999 get_selected_printer is transfer none
    
    gtk_print_unix_dialog_get_settings returns a new GObject we
    have to unref, but gtk_print_unix_dialog_get_selected_printer doesn't
    add a ref so dies along with its parent dialog.
    
    Change-Id: Ie5f8ecd83f5cc2c13e4a8c3ba292ffa381f9bdf5
    (cherry picked from commit c12e14d19f86be8555f6262d138cf0776f2c9b56)
    Reviewed-on: https://gerrit.libreoffice.org/29773
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/vcl/unx/gtk/gtkprintwrapper.cxx b/vcl/unx/gtk/gtkprintwrapper.cxx
index cae1658..248ccf1 100644
--- a/vcl/unx/gtk/gtkprintwrapper.cxx
+++ b/vcl/unx/gtk/gtkprintwrapper.cxx
@@ -276,13 +276,16 @@ void GtkPrintWrapper::print_unix_dialog_add_custom_tab(GtkPrintUnixDialog* dialo
 
 GtkPrinter* GtkPrintWrapper::print_unix_dialog_get_selected_printer(GtkPrintUnixDialog* dialog) const
 {
+    GtkPrinter* pRet = nullptr;
 #if !GTK_CHECK_VERSION(3,0,0)
     assert(m_print_unix_dialog_get_selected_printer);
-    return (*m_print_unix_dialog_get_selected_printer)(dialog);
+    pRet = (*m_print_unix_dialog_get_selected_printer)(dialog);
 #else
     (void) this; // loplugin:staticmethods
-    return gtk_print_unix_dialog_get_selected_printer(dialog);
+    pRet = gtk_print_unix_dialog_get_selected_printer(dialog);
 #endif
+    g_object_ref(G_OBJECT(pRet));
+    return pRet;
 }
 
 void GtkPrintWrapper::print_unix_dialog_set_manual_capabilities(GtkPrintUnixDialog* dialog, GtkPrintCapabilities capabilities) const


More information about the Libreoffice-commits mailing list