mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:59:17 +02:00
LCL-GTK3: Prevent a crash while exiting. Issue #38635, patch from Anton Kavalenka.
git-svn-id: trunk@64841 -
This commit is contained in:
parent
a4e3ce8735
commit
01aadf340e
@ -89,6 +89,7 @@ type
|
|||||||
procedure SetFont(AValue: PPangoFontDescription);
|
procedure SetFont(AValue: PPangoFontDescription);
|
||||||
procedure SetVisible(AValue: Boolean);
|
procedure SetVisible(AValue: Boolean);
|
||||||
procedure SetStyleContext(AValue: PGtkStyleContext);
|
procedure SetStyleContext(AValue: PGtkStyleContext);
|
||||||
|
class procedure destroy_event(w:Tgtk3Widget;data:gpointer);cdecl;
|
||||||
protected
|
protected
|
||||||
// IUnknown implementation
|
// IUnknown implementation
|
||||||
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
|
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
|
||||||
@ -2507,6 +2508,12 @@ begin
|
|||||||
GetContainerWidget^.set_style(AValue);}
|
GetContainerWidget^.set_style(AValue);}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk3Widget.destroy_event(w: Tgtk3Widget; data: gpointer); cdecl;
|
||||||
|
begin
|
||||||
|
if Assigned(w) then
|
||||||
|
w.fWidget:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGtk3Widget.getText: String;
|
function TGtk3Widget.getText: String;
|
||||||
begin
|
begin
|
||||||
Result := fText; // default text storage
|
Result := fText; // default text storage
|
||||||
@ -2647,9 +2654,9 @@ begin
|
|||||||
|
|
||||||
// move signal connections into attach events
|
// move signal connections into attach events
|
||||||
FWidget^.set_events(GDK_DEFAULT_EVENTS_MASK);
|
FWidget^.set_events(GDK_DEFAULT_EVENTS_MASK);
|
||||||
|
g_signal_connect_data(FWidget, 'destroy', TGCallback(@TGtk3Widget.destroy_event), Self, nil, 0);
|
||||||
g_signal_connect_data(FWidget, 'event', TGCallback(@Gtk3WidgetEvent), Self, nil, 0);
|
g_signal_connect_data(FWidget, 'event', TGCallback(@Gtk3WidgetEvent), Self, nil, 0);
|
||||||
|
|
||||||
|
|
||||||
for i := GTK_STATE_NORMAL to GTK_STATE_INSENSITIVE do
|
for i := GTK_STATE_NORMAL to GTK_STATE_INSENSITIVE do
|
||||||
begin
|
begin
|
||||||
FWidget^.get_style_context^.get_background_color(i, @ARgba);
|
FWidget^.get_style_context^.get_background_color(i, @ARgba);
|
||||||
@ -2662,7 +2669,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
if FCentralWidget <> nil then
|
if FCentralWidget <> nil then
|
||||||
begin
|
begin
|
||||||
FCentralWidget^.set_events(GDK_DEFAULT_EVENTS_MASK);
|
FCentralWidget^.set_events(GDK_DEFAULT_EVENTS_MASK);
|
||||||
|
Loading…
Reference in New Issue
Block a user