mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 04:39:13 +02:00
few mem leaks
git-svn-id: trunk@13809 -
This commit is contained in:
parent
fea0888a37
commit
e50a1ae171
@ -106,7 +106,6 @@ type
|
|||||||
function CreateWidget(const Params: TCreateParams):QWidgetH; virtual;
|
function CreateWidget(const Params: TCreateParams):QWidgetH; virtual;
|
||||||
procedure SetHasCaret(const AValue: Boolean);
|
procedure SetHasCaret(const AValue: Boolean);
|
||||||
public
|
public
|
||||||
AVariant: QVariantH;
|
|
||||||
LCLObject: TWinControl;
|
LCLObject: TWinControl;
|
||||||
public
|
public
|
||||||
constructor Create(const AWinControl: TWinControl; const AParams: TCreateParams); virtual; reintroduce;
|
constructor Create(const AWinControl: TWinControl; const AParams: TCreateParams); virtual; reintroduce;
|
||||||
@ -1141,6 +1140,8 @@ end;
|
|||||||
|
|
||||||
constructor TQtWidget.CreateFrom(const AWinControl: TWinControl;
|
constructor TQtWidget.CreateFrom(const AWinControl: TWinControl;
|
||||||
AWidget: QWidgetH);
|
AWidget: QWidgetH);
|
||||||
|
var
|
||||||
|
AVariant: QVariantH;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
@ -1158,10 +1159,11 @@ begin
|
|||||||
QWidget_cursor(Widget, FDefaultCursor);
|
QWidget_cursor(Widget, FDefaultCursor);
|
||||||
|
|
||||||
// set Handle->QWidget map
|
// set Handle->QWidget map
|
||||||
AVariant := QVariant_Create(Int64(ptruint(Self)));
|
AVariant := QVariant_create(Int64(PtrUInt(Self)));
|
||||||
QObject_setProperty(QObjectH(Widget), 'lclwidget', AVariant);
|
QObject_setProperty(QObjectH(Widget), 'lclwidget', AVariant);
|
||||||
|
QVariant_destroy(AVariant);
|
||||||
|
|
||||||
fillchar(FPaintData, sizeOf(FPaintData), 0);
|
FillChar(FPaintData, sizeOf(FPaintData), 0);
|
||||||
|
|
||||||
// set focus policy
|
// set focus policy
|
||||||
if (LCLObject <> nil) and not (Self is TQtMainWindow) then
|
if (LCLObject <> nil) and not (Self is TQtMainWindow) then
|
||||||
@ -1177,6 +1179,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtWidget.InitializeWidget;
|
procedure TQtWidget.InitializeWidget;
|
||||||
|
var
|
||||||
|
AVariant: QVariantH;
|
||||||
begin
|
begin
|
||||||
// Creates the widget
|
// Creates the widget
|
||||||
Widget := CreateWidget(FParams);
|
Widget := CreateWidget(FParams);
|
||||||
@ -1191,8 +1195,9 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
// set Handle->QWidget map
|
// set Handle->QWidget map
|
||||||
AVariant := QVariant_Create(Int64(PtrUInt(Self)));
|
AVariant := QVariant_create(Int64(PtrUInt(Self)));
|
||||||
QObject_setProperty(Widget, 'lclwidget', AVariant);
|
QObject_setProperty(Widget, 'lclwidget', AVariant);
|
||||||
|
QVariant_destroy(AVariant);
|
||||||
|
|
||||||
FillChar(FPaintData, sizeOf(FPaintData), 0);
|
FillChar(FPaintData, sizeOf(FPaintData), 0);
|
||||||
|
|
||||||
@ -1212,13 +1217,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtWidget.DeInitializeWidget;
|
procedure TQtWidget.DeInitializeWidget;
|
||||||
|
var
|
||||||
|
V: QVariantH;
|
||||||
begin
|
begin
|
||||||
if Widget <> nil then
|
if Widget <> nil then
|
||||||
DetachEvents;
|
DetachEvents;
|
||||||
|
|
||||||
QVariant_destroy(AVariant);
|
|
||||||
if Widget <> nil then
|
if Widget <> nil then
|
||||||
QObject_setProperty(Widget, 'lclwidget', QVariant_create(QVariantInvalid));
|
begin
|
||||||
|
V := QVariant_create(QVariantInvalid);
|
||||||
|
QObject_setProperty(Widget, 'lclwidget', V);
|
||||||
|
QVariant_destroy(V);
|
||||||
|
end;
|
||||||
|
|
||||||
QCursor_destroy(FDefaultCursor);
|
QCursor_destroy(FDefaultCursor);
|
||||||
|
|
||||||
@ -3487,20 +3497,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
destructor TQtMainWindow.Destroy;
|
destructor TQtMainWindow.Destroy;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQt}
|
// The main window takes care of the menubar handle
|
||||||
WriteLn('TQtMainWindow.Destroy');
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
if Widget <> nil then
|
|
||||||
begin
|
|
||||||
DetachEvents;
|
|
||||||
QObject_setProperty(Widget, 'lclwidget', QVariant_create(QVariantInvalid));
|
|
||||||
QObject_deleteLater(Widget);
|
|
||||||
Widget := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ The main window takes care of the menubar handle}
|
|
||||||
|
|
||||||
if MenuBar <> nil then
|
if MenuBar <> nil then
|
||||||
begin
|
begin
|
||||||
MenuBar.Widget := nil;
|
MenuBar.Widget := nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user