LCL: GTK2: Fixed memory leak in StatusBar. Issue #34951

git-svn-id: trunk@60250 -
This commit is contained in:
michl 2019-01-30 21:54:31 +00:00
parent d66f084d39
commit ec7a5c0cd1

View File

@ -6263,6 +6263,7 @@ var
NewShadowType: TGtkShadowType; NewShadowType: TGtkShadowType;
NewJustification: TGtkJustification; NewJustification: TGtkJustification;
xalign, yalign: gfloat; xalign, yalign: gfloat;
MessageId: guint;
begin begin
//DebugLn('UpdateStatusBarPanel ',DbgS(StatusBar),' Index=',dbgs(Index)); //DebugLn('UpdateStatusBarPanel ',DbgS(StatusBar),' Index=',dbgs(Index));
AStatusBar := StatusBar as TStatusBar; AStatusBar := StatusBar as TStatusBar;
@ -6293,10 +6294,11 @@ begin
'state'); 'state');
//DebugLn(' PanelText="',PanelText,'"'); //DebugLn(' PanelText="',PanelText,'"');
if PanelText <> '' then if PanelText <> '' then
gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget), ContextID, PGChar(PanelText)) MessageId := gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget), ContextID, PGChar(PanelText))
else else
gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget), ContextID, ''); MessageId := gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget), ContextID, '');
if MessageId > 1 then
gtk_statusbar_remove(PGTKStatusBar(StatusPanelWidget), ContextID, MessageId - 1);
if CurPanel <> nil then if CurPanel <> nil then
begin begin
@ -6339,8 +6341,9 @@ begin
g_object_set_data(PGObject(StatusPanelWidget),'lcl_statusbar_id', g_object_set_data(PGObject(StatusPanelWidget),'lcl_statusbar_id',
@AStatusBar.Panels[Index].ID); @AStatusBar.Panels[Index].ID);
g_signal_connect_after(StatusPanelWidget, 'expose-event', if AStatusBar.Panels[Index].Style = psOwnerDraw then
TGtkSignalFunc(@gtk2PaintStatusBarWidget), AStatusBar); g_signal_connect_after(StatusPanelWidget, 'expose-event',
TGtkSignalFunc(@gtk2PaintStatusBarWidget), AStatusBar);
end; end;
end; end;