]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't cast with G_OBJECT when passing a GObject to g_object_ref, g_object_unref and...
authorMart Raudsepp <leio@gentoo.org>
Mon, 15 May 2006 14:17:38 +0000 (14:17 +0000)
committerMart Raudsepp <leio@gentoo.org>
Mon, 15 May 2006 14:17:38 +0000 (14:17 +0000)
They take a gpointer, not GObject*, and unnecessary casting not all that speedy with GObject types.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/artgtk.cpp
src/gtk/bitmap.cpp
src/gtk/cursor.cpp
src/gtk/dcclient.cpp
src/gtk/dirdlg.cpp
src/gtk/filedlg.cpp
src/gtk/gnome/gprint.cpp
src/gtk/listbox.cpp
src/gtk/minifram.cpp
src/gtk/window.cpp

index c31b1c8c8e169de986459500413b56107b4ac12b..f1de4e09518e5c825d3754b06e0a17b857c72bc1 100644 (file)
@@ -206,7 +206,7 @@ static GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
         GtkWidget *widget = gtk_button_new();
         gs_gtkStyle = gtk_rc_get_style(widget);
         wxASSERT( gs_gtkStyle != NULL );
-        g_object_ref(G_OBJECT(gs_gtkStyle));
+        g_object_ref(gs_gtkStyle);
         gtk_widget_destroy(widget);
     }
 
@@ -273,7 +273,7 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
                                                 GDK_INTERP_BILINEAR);
         if (p2)
         {
-            g_object_unref (G_OBJECT (pixbuf));
+            g_object_unref (pixbuf);
             pixbuf = p2;
         }
     }
@@ -301,7 +301,7 @@ public:
     {
         if (gs_gtkStyle)
         {
-            g_object_unref(G_OBJECT(gs_gtkStyle));
+            g_object_unref(gs_gtkStyle);
             gs_gtkStyle = NULL;
         }
     }
index 4a0e1111f1d74a6360a6e26b75056b13daa317a1..e405233ceb1fe4cba3b165a06185355f15e8730a 100644 (file)
@@ -83,7 +83,7 @@ wxMask::wxMask( const wxBitmap& bitmap )
 wxMask::~wxMask()
 {
     if (m_bitmap)
-        g_object_unref (G_OBJECT (m_bitmap));
+        g_object_unref (m_bitmap);
 }
 
 bool wxMask::Create( const wxBitmap& bitmap,
@@ -91,7 +91,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
 {
     if (m_bitmap)
     {
-        g_object_unref (G_OBJECT (m_bitmap));
+        g_object_unref (m_bitmap);
         m_bitmap = (GdkBitmap*) NULL;
     }
 
@@ -174,7 +174,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
             gdk_draw_line( m_bitmap, gc, start_x, j, i, j );
     }
 
-    g_object_unref (G_OBJECT (gc));
+    g_object_unref (gc);
 
     return true;
 }
@@ -197,7 +197,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
 {
     if (m_bitmap)
     {
-        g_object_unref (G_OBJECT (m_bitmap));
+        g_object_unref (m_bitmap);
         m_bitmap = (GdkBitmap*) NULL;
     }
 
@@ -213,7 +213,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
 
     gdk_wx_draw_bitmap( m_bitmap, gc, bitmap.GetBitmap(), 0, 0, 0, 0, bitmap.GetWidth(), bitmap.GetHeight() );
 
-    g_object_unref (G_OBJECT (gc));
+    g_object_unref (gc);
 
     return true;
 }
@@ -258,11 +258,11 @@ wxBitmapRefData::wxBitmapRefData()
 wxBitmapRefData::~wxBitmapRefData()
 {
     if (m_pixmap)
-        g_object_unref (G_OBJECT (m_pixmap));
+        g_object_unref (m_pixmap);
     if (m_bitmap)
-        g_object_unref (G_OBJECT (m_bitmap));
+        g_object_unref (m_bitmap);
     if (m_pixbuf)
-        g_object_unref (G_OBJECT (m_pixbuf));
+        g_object_unref (m_pixbuf);
     delete m_mask;
 #if wxUSE_PALETTE
     delete m_palette;
@@ -485,8 +485,8 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
                 dst[h*dstbyteperline+width/8] = outbyte;
         }
 
-        g_object_unref (G_OBJECT (img));
-        if (gc) g_object_unref (G_OBJECT (gc));
+        g_object_unref (img);
+        if (gc) g_object_unref (gc);
 
         if ( dst )
         {
@@ -544,7 +544,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
             bmp.SetMask(mask);
 
             free( dst );
-            g_object_unref (G_OBJECT (img));
+            g_object_unref (img);
         }
 
         free( tablex );
@@ -661,8 +661,8 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
 
     gdk_draw_image( GetBitmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
 
-    g_object_unref (G_OBJECT (data_image));
-    g_object_unref (G_OBJECT (data_gc));
+    g_object_unref (data_image);
+    g_object_unref (data_gc);
 
     // Blit mask
 
@@ -672,8 +672,8 @@ bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
 
         gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
 
-        g_object_unref (G_OBJECT (mask_image));
-        g_object_unref (G_OBJECT (mask_gc));
+        g_object_unref (mask_image);
+        g_object_unref (mask_gc);
     }
 
     return true;
@@ -732,7 +732,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
                             image.GetData(),
                             width*3 );
 
-        g_object_unref (G_OBJECT (gc));
+        g_object_unref (gc);
         return true;
     }
 
@@ -901,8 +901,8 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
 
     gdk_draw_image( GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
 
-    g_object_unref (G_OBJECT (data_image));
-    g_object_unref (G_OBJECT (data_gc));
+    g_object_unref (data_image);
+    g_object_unref (data_gc);
 
     // Blit mask
 
@@ -912,8 +912,8 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& img)
 
         gdk_draw_image( GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
 
-        g_object_unref (G_OBJECT (mask_image));
-        g_object_unref (G_OBJECT (mask_gc));
+        g_object_unref (mask_image);
+        g_object_unref (mask_gc);
     }
 
     return true;
@@ -1137,8 +1137,8 @@ wxImage wxBitmap::ConvertToImage() const
             }
         }
 
-        g_object_unref (G_OBJECT (gdk_image));
-        if (gdk_image_mask) g_object_unref (G_OBJECT (gdk_image_mask));
+        g_object_unref (gdk_image);
+        if (gdk_image_mask) g_object_unref (gdk_image_mask);
     }
 
     return image;
@@ -1263,7 +1263,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
         {
             GdkGC *gc = gdk_gc_new( ret.GetPixmap() );
             gdk_draw_drawable( ret.GetPixmap(), gc, GetPixmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
-            g_object_unref (G_OBJECT (gc));
+            g_object_unref (gc);
         }
         else
         {
@@ -1274,7 +1274,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
             col.pixel = 0;
             gdk_gc_set_background( gc, &col );
             gdk_wx_draw_bitmap( ret.GetBitmap(), gc, GetBitmap(), rect.x, rect.y, 0, 0, rect.width, rect.height );
-            g_object_unref (G_OBJECT (gc));
+            g_object_unref (gc);
         }
     }
 
@@ -1290,7 +1290,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
         col.pixel = 0;
         gdk_gc_set_background( gc, &col );
         gdk_wx_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, rect.x, rect.y, 0, 0, rect.width, rect.height );
-        g_object_unref (G_OBJECT (gc));
+        g_object_unref (gc);
 
         ret.SetMask( mask );
     }
@@ -1486,7 +1486,7 @@ GdkPixbuf *wxBitmap::GetPixbuf() const
                     }
                 }
 
-                g_object_unref (G_OBJECT (pmask));
+                g_object_unref (pmask);
             }
         }
     }
@@ -1514,12 +1514,12 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep)
 {
     if (keep == Pixmap && HasPixbuf())
     {
-        g_object_unref (G_OBJECT (M_BMPDATA->m_pixbuf));
+        g_object_unref (M_BMPDATA->m_pixbuf);
         M_BMPDATA->m_pixbuf = NULL;
     }
     if (keep == Pixbuf && HasPixmap())
     {
-        g_object_unref (G_OBJECT (M_BMPDATA->m_pixmap));
+        g_object_unref (M_BMPDATA->m_pixmap);
         M_BMPDATA->m_pixmap = NULL;
     }
 }
index c975d3cf0d3474fc696a85eb8bae2cc655a98082..d02105ec8b92d052e6cce486cf6cd6b792df50a9 100644 (file)
@@ -147,8 +147,8 @@ wxCursor::wxCursor(const char bits[], int width, int  height,
                  data, mask, fg->GetColor(), bg->GetColor(),
                  hotSpotX, hotSpotY );
 
-    g_object_unref (G_OBJECT (data));
-    g_object_unref (G_OBJECT (mask));
+    g_object_unref (data);
+    g_object_unref (mask);
 }
 
 #if wxUSE_IMAGE
@@ -299,8 +299,8 @@ wxCursor::wxCursor( const wxImage & image )
                                 hotSpotX, hotSpotY
                              );
 
-    g_object_unref (G_OBJECT (data));
-    g_object_unref (G_OBJECT (mask));
+    g_object_unref (data);
+    g_object_unref (mask);
     delete [] bits;
     delete [] maskBits;
 }
index cfb49766cd8606f46ffc3195aa4768e25f16c4eb..bd8d184fc17359969c8d12b129223d3ebf3ff2c8 100644 (file)
@@ -176,7 +176,7 @@ static void wxCleanUpGCPool()
     for (int i = 0; i < wxGCPoolSize; i++)
     {
         if (wxGCPool[i].m_gc)
-            g_object_unref (G_OBJECT (wxGCPool[i].m_gc));
+            g_object_unref (wxGCPool[i].m_gc);
     }
 
     free(wxGCPool);
@@ -332,7 +332,7 @@ wxWindowDC::~wxWindowDC()
     Destroy();
 
     if (m_layout)
-        g_object_unref( G_OBJECT( m_layout ) );
+        g_object_unref (m_layout);
     if (m_fontdesc)
         pango_font_description_free( m_fontdesc );
 }
@@ -1130,7 +1130,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
             gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
             gdk_gc_set_stipple( gc, mask );
             gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
-            g_object_unref (G_OBJECT (gc));
+            g_object_unref (gc);
         }
 
         if (is_mono)
@@ -1163,8 +1163,8 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
 
         gdk_draw_drawable( m_window, m_textGC, bitmap2, 0, 0, xx, yy, -1, -1 );
 
-        g_object_unref (G_OBJECT (bitmap2));
-        g_object_unref (G_OBJECT (gc));
+        g_object_unref (bitmap2);
+        g_object_unref (gc);
     }
     else
     {
@@ -1205,7 +1205,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
     }
 
     if (new_mask)
-        g_object_unref (G_OBJECT (new_mask));
+        g_object_unref (new_mask);
 }
 
 bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
@@ -1373,7 +1373,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
                 gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
                 gdk_gc_set_stipple( gc, mask );
                 gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
-                g_object_unref (G_OBJECT (gc));
+                g_object_unref (gc);
             }
 
             if (is_mono)
@@ -1417,8 +1417,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
 
             gdk_draw_drawable( m_window, m_textGC, bitmap, xsrc, ysrc, cx, cy, cw, ch );
 
-            g_object_unref (G_OBJECT (bitmap));
-            g_object_unref (G_OBJECT (gc));
+            g_object_unref (bitmap);
+            g_object_unref (gc);
         }
         else
         {
@@ -1446,7 +1446,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
         }
 
         if (new_mask)
-            g_object_unref (G_OBJECT (new_mask));
+            g_object_unref (new_mask);
     }
     else // use_bitmap_method
     {
@@ -1826,7 +1826,7 @@ void wxWindowDC::SetFont( const wxFont &font )
             if (oldContext != m_context)
             {
                 if (m_layout)
-                    g_object_unref( G_OBJECT( m_layout ) );
+                    g_object_unref (m_layout);
 
                 m_layout = pango_layout_new( m_context );
             }
index 5247f67f54d1f3cd9dce3e603b0a4ea37846cd23..b7c817993b8810cf179def812d82325ec8e4cdaf 100644 (file)
@@ -155,8 +155,8 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
         // Currently local-only is kept as the default - true:
         // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
 
-        g_signal_connect(G_OBJECT(m_widget), "response",
-            GTK_SIGNAL_FUNC(gtk_filedialog_response_callback), (gpointer)this);
+        g_signal_connect (m_widget, "response",
+            G_CALLBACK (gtk_filedialog_response_callback), this);
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
index 4488c5e837339dea1f365571717a6fd6025c54d5..547045ec5ce865a8480517a81f8e58c1abd26df5 100644 (file)
@@ -189,8 +189,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         // Currently local-only is kept as the default - true:
         // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
 
-        g_signal_connect(G_OBJECT(m_widget), "response",
-            GTK_SIGNAL_FUNC(gtk_filedialog_response_callback), (gpointer)this);
+        g_signal_connect (m_widget, "response",
+            G_CALLBACK (gtk_filedialog_response_callback), this);
 
         SetWildcard(wildCard);
 
index cf2ebd86bcac2d3622b14447fd036d15c2360534..02ad8b7b467dfe49d0ca6c9caddbc5a06eee6fcf 100644 (file)
@@ -280,7 +280,7 @@ wxGnomePrintNativeData::wxGnomePrintNativeData()
 
 wxGnomePrintNativeData::~wxGnomePrintNativeData()
 {
-    g_object_unref (G_OBJECT (m_config));
+    g_object_unref (m_config);
 }
 
 bool wxGnomePrintNativeData::TransferTo( wxPrintData &data )
@@ -707,7 +707,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
     if (!dc)
     {
         gs_lgp->gnome_print_job_close( job );
-        g_object_unref (G_OBJECT (job));
+        g_object_unref (job);
         sm_lastError = wxPRINTER_ERROR;
         return false;
     }
@@ -738,7 +738,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
     if (maxPage == 0)
     {
         gs_lgp->gnome_print_job_close( job );
-        g_object_unref (G_OBJECT (job));
+        g_object_unref (job);
         sm_lastError = wxPRINTER_ERROR;
         return false;
     }
@@ -796,7 +796,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
         gs_lgp->gnome_print_job_print( job );
     }
 
-    g_object_unref (G_OBJECT (job));
+    g_object_unref (job);
     delete dc;
 
     return (sm_lastError == wxPRINTER_NO_ERROR);
index 21fc6d64bfdc89e02c8358a8a403073016253bce..a8d8ab56454205c459f6b221aec20f361a9c0835 100644 (file)
@@ -106,7 +106,7 @@ gtk_listbox_row_activated_callback(GtkTreeView        *treeview,
                     (wxClientData*) gtk_tree_entry_get_userdata(entry) );
                 else if ( listbox->HasClientUntypedData() )
                     event.SetClientData( gtk_tree_entry_get_userdata(entry) );
-                g_object_unref(G_OBJECT(entry));
+                g_object_unref (entry);
             }
             else
             {
@@ -320,7 +320,7 @@ static gboolean gtk_listitem_select_cb( GtkTreeSelection* selection,
 
         listbox->GetEventHandler()->ProcessEvent( event );
 
-        g_object_unref(G_OBJECT(entry));
+        g_object_unref (entry);
         return FALSE;  //We handled it/did it manually
     }
 
@@ -374,8 +374,8 @@ static gint gtk_listbox_sort_callback(GtkTreeModel *model,
     int ret = strcasecmp(gtk_tree_entry_get_collate_key(entry),
                          gtk_tree_entry_get_collate_key(entry2));
 
-    g_object_unref(G_OBJECT(entry));
-    g_object_unref(G_OBJECT(entry2));
+    g_object_unref (entry);
+    g_object_unref (entry2);
 
     return ret;
 }
@@ -405,7 +405,7 @@ static gboolean gtk_listbox_searchequal_callback(GtkTreeModel* model,
                          gtk_tree_entry_get_collate_key(entry));
 
     g_free(keycollatekey);
-    g_object_unref(G_OBJECT(entry));
+    g_object_unref (entry);
 
     return ret != 0;
 }
@@ -502,7 +502,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     gtk_tree_view_set_model(m_treeview, GTK_TREE_MODEL(m_liststore));
 
-    g_object_unref(G_OBJECT(m_liststore)); //free on treeview destruction
+    g_object_unref (m_liststore); //free on treeview destruction
 
     // Disable the pop-up textctrl that enables searching - note that
     // the docs specify that even if this disabled (which we are doing)
@@ -663,7 +663,7 @@ void wxListBox::GtkInsertItems(const wxArrayString& items,
             gtk_list_store_set(m_liststore, &itercur,
                                  0, entry, -1);
 
-        g_object_unref(G_OBJECT(entry)); //liststore always refs :)
+        g_object_unref (entry); //liststore always refs :)
     }
 }
 
@@ -765,7 +765,7 @@ void* wxListBox::DoGetItemClientData(unsigned int n) const
     wxCHECK_MSG(entry, NULL, wxT("could not get entry"));
 
     void* userdata = gtk_tree_entry_get_userdata( entry );
-    g_object_unref(G_OBJECT(entry));
+    g_object_unref (entry);
     return userdata;
 }
 
@@ -783,7 +783,7 @@ void wxListBox::DoSetItemClientData(unsigned int n, void* clientData)
     wxCHECK_RET(entry, wxT("could not get entry"));
 
     gtk_tree_entry_set_userdata( entry, clientData );
-    g_object_unref(G_OBJECT(entry));
+    g_object_unref (entry);
 }
 
 void wxListBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
@@ -816,7 +816,7 @@ void wxListBox::SetString(unsigned int n, const wxString &string)
     // notification function...
     void* userdata = gtk_tree_entry_get_userdata(entry);
     gtk_tree_entry_set_userdata(entry, NULL); //don't delete on destroy
-    g_object_unref(G_OBJECT(entry));
+    g_object_unref (entry);
 
     bool bWasSelected = wxListBox::IsSelected(n);
     wxListBox::Delete(n);
@@ -845,7 +845,7 @@ wxString wxListBox::GetString(unsigned int n) const
         label.erase(0, 4);
 #endif // wxUSE_CHECKLISTBOX
 
-    g_object_unref(G_OBJECT(entry));
+    g_object_unref (entry);
     return label;
 }
 
index 45beaf5a6bfcfcb7b79747b12f64c2f6c5c2eb62..952ed022d6505a614e07a2b04228e2aa075552e4 100644 (file)
@@ -53,7 +53,7 @@ static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h )
     gdk_gc_set_function( gc, GDK_INVERT );
 
     gdk_draw_rectangle( gdk_get_default_root_window(), gc, FALSE, x, y, w, h );
-    g_object_unref (G_OBJECT (gc));
+    g_object_unref (gc);
 }
 
 //-----------------------------------------------------------------------------
@@ -94,7 +94,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
                             3,
                             win->m_width - 7,
                             height+1 );
-        g_object_unref (G_OBJECT (gc));
+        g_object_unref (gc);
 
         // Hack alert
         dc.m_window = pizza->bin_window;
@@ -292,8 +292,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
                             );
 
         GtkWidget *pw = gtk_pixmap_new( pixmap, mask );
-        g_object_unref (G_OBJECT (mask));
-        g_object_unref (G_OBJECT (pixmap));
+        g_object_unref (mask);
+        g_object_unref (pixmap);
         gtk_widget_show( pw );
 
         GtkWidget *close_button = gtk_button_new();
index b0b3fc5bf04c6d5d60505f9a0f34f9fa6703ae46..b71e53380ef7e67476dd80193abd8a219db31efe 100644 (file)
@@ -397,7 +397,7 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
         gdk_draw_rectangle( widget->window, gc, FALSE,
                          dx, dy,
                          widget->allocation.width-dw-1, widget->allocation.height-dh-1 );
-        g_object_unref (G_OBJECT (gc));
+        g_object_unref (gc);
         return;
     }
 #endif // __WXUNIVERSAL__
@@ -973,7 +973,7 @@ struct wxGtkIMData
     }
     ~wxGtkIMData()
     {
-        g_object_unref(context);
+        g_object_unref (context);
     }
 };
 
@@ -3320,7 +3320,7 @@ int wxWindowGTK::GetCharHeight() const
     PangoRectangle rect;
     pango_layout_line_get_extents(line, NULL, &rect);
 
-    g_object_unref( G_OBJECT( layout ) );
+    g_object_unref (layout);
 
     return (int) PANGO_PIXELS(rect.height);
 }
@@ -3348,7 +3348,7 @@ int wxWindowGTK::GetCharWidth() const
     PangoRectangle rect;
     pango_layout_line_get_extents(line, NULL, &rect);
 
-    g_object_unref( G_OBJECT( layout ) );
+    g_object_unref (layout);
 
     return (int) PANGO_PIXELS(rect.width);
 }
@@ -3405,7 +3405,7 @@ void wxWindowGTK::GetTextExtent( const wxString& string,
     }
     if (externalLeading) (*externalLeading) = 0;  // ??
 
-    g_object_unref( G_OBJECT( layout ) );
+    g_object_unref (layout);
 }
 
 void wxWindowGTK::SetFocus()
@@ -4388,5 +4388,5 @@ bool wxWinModule::OnInit()
 void wxWinModule::OnExit()
 {
     if (g_eraseGC)
-        g_object_unref (G_OBJECT (g_eraseGC));
+        g_object_unref (g_eraseGC);
 }