From d43964d5f1b5601727d8fd2067ec05d23ba9cea8 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 8 Sep 2009 06:58:44 +0000 Subject: [PATCH] gtk: take care of LastWPResult when we are disconnecting all widget signal handlers (must fix bug #0014512) git-svn-id: trunk@21608 - --- lcl/interfaces/gtk/gtkwidgetset.inc | 41 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/lcl/interfaces/gtk/gtkwidgetset.inc b/lcl/interfaces/gtk/gtkwidgetset.inc index 1f540fefc0..d4dc03ad31 100644 --- a/lcl/interfaces/gtk/gtkwidgetset.inc +++ b/lcl/interfaces/gtk/gtkwidgetset.inc @@ -3760,29 +3760,38 @@ var Info: PWinWidgetInfo; {$ENDIF} begin + if Widget = nil then Exit; {$IFDEF Gtk1} MainWidget := Widget; - if MainWidget = nil then Exit; - if GtkWidgetIsA(Widget,GTK_MENU_ITEM_GET_TYPE) then exit; + if GtkWidgetIsA(Widget, GTK_MENU_ITEM_GET_TYPE) then Exit; - ClientWidget:=GetFixedWidget(MainWidget); - WinWidgetInfo:=GetWidgetInfo(MainWidget,false); - if WinWidgetInfo<>nil then - ImplWidget:=WinWidgetInfo^.CoreWidget + ClientWidget := GetFixedWidget(MainWidget); + WinWidgetInfo := GetWidgetInfo(MainWidget, False); + if WinWidgetInfo <> nil then + ImplWidget := WinWidgetInfo^.CoreWidget else - ImplWidget:=nil; + ImplWidget := nil; + if MainWidget = PGtkWidget(LastWFPResult) then + DestroyWindowFromPointCB(MainWidget, nil); g_signal_handlers_destroy(PGtkObject(MainWidget)); - if (ClientWidget<>nil) and (ClientWidget<>MainWidget) then + if (ClientWidget <> nil) and (ClientWidget <> MainWidget) then + begin + if ClientWidget = PGtkWidget(LastWFPResult) then + DestroyWindowFromPointCB(ClientWidget, nil); g_signal_handlers_destroy(PGtkObject(ClientWidget)); - if (ImplWidget<>nil) - and (ImplWidget<>ClientWidget) and (ImplWidget<>MainWidget) then - g_signal_handlers_destroy(PGtkObject(ImplWidget)); - {$ELSE} - if Widget=nil then exit; - Info:=GetWidgetInfo(Widget,false); - if Info<>nil then begin - g_signal_handlers_disconnect_matched(Widget,G_SIGNAL_MATCH_DATA,0,0,nil,nil,Info); end; + if (ImplWidget <> nil) and + (ImplWidget <> ClientWidget) and + (ImplWidget <> MainWidget) then + begin + if ImplWidget = PGtkWidget(LastWFPResult) then + DestroyWindowFromPointCB(ImplWidget, nil); + g_signal_handlers_destroy(PGtkObject(ImplWidget)); + end; + {$ELSE} + Info := GetWidgetInfo(Widget, False); + if Info <> nil then + g_signal_handlers_disconnect_matched(Widget, G_SIGNAL_MATCH_DATA, 0, 0, nil, nil, Info); {$ENDIF} end;