mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 05:50:30 +02:00
more checks before DetachEvents
git-svn-id: trunk@11467 -
This commit is contained in:
parent
e238453328
commit
5945ec2de9
@ -540,11 +540,14 @@ type
|
|||||||
|
|
||||||
TQtHeaderView = class (TQtAbstractItemView)
|
TQtHeaderView = class (TQtAbstractItemView)
|
||||||
private
|
private
|
||||||
|
FSelectionClicked: QHeaderView_hookH;
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
|
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
|
||||||
public
|
public
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
public
|
public
|
||||||
|
procedure AttachEvents; override;
|
||||||
|
procedure DetachEvents; override;
|
||||||
procedure SignalSectionClicked(logicalIndex: Integer) cdecl;
|
procedure SignalSectionClicked(logicalIndex: Integer) cdecl;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2099,9 +2102,12 @@ begin
|
|||||||
WriteLn('TQtPushButton.Destroy');
|
WriteLn('TQtPushButton.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QPushButton_destroy(QPushButtonH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QPushButton_destroy(QPushButtonH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2467,9 +2473,12 @@ begin
|
|||||||
WriteLn('TQtStaticText.Destroy');
|
WriteLn('TQtStaticText.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QLabel_destroy(QLabelH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QLabel_destroy(QLabelH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2599,9 +2608,12 @@ begin
|
|||||||
WriteLn('TQtCheckBox.Destroy');
|
WriteLn('TQtCheckBox.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QCheckBox_destroy(QCheckBoxH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QCheckBox_destroy(QCheckBoxH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2724,9 +2736,12 @@ begin
|
|||||||
WriteLn('TQtRadioButton.Destroy');
|
WriteLn('TQtRadioButton.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QRadioButton_destroy(QRadioButtonH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QRadioButton_destroy(QRadioButtonH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2787,9 +2802,12 @@ begin
|
|||||||
WriteLn('TQtGroupBox.Destroy');
|
WriteLn('TQtGroupBox.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QGroupBox_destroy(QGroupBoxH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QGroupBox_destroy(QGroupBoxH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2820,9 +2838,12 @@ begin
|
|||||||
WriteLn('TQtFrame.Destroy');
|
WriteLn('TQtFrame.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QFrame_destroy(QFrameH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QFrame_destroy(QFrameH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -2903,9 +2924,12 @@ begin
|
|||||||
WriteLn('TQtAbstractSlider.Destroy');
|
WriteLn('TQtAbstractSlider.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QAbstractSlider_destroy(QAbstractSliderH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QAbstractSlider_destroy(QAbstractSliderH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3352,9 +3376,12 @@ begin
|
|||||||
WriteLn('TQtLineEdit.Destroy');
|
WriteLn('TQtLineEdit.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QLineEdit_destroy(QLineEditH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QLineEdit_destroy(QLineEditH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3374,9 +3401,8 @@ end;
|
|||||||
|
|
||||||
procedure TQtLineEdit.DetachEvents;
|
procedure TQtLineEdit.DetachEvents;
|
||||||
begin
|
begin
|
||||||
inherited DetachEvents;
|
|
||||||
|
|
||||||
QLineEdit_hook_destroy(FTextChanged);
|
QLineEdit_hook_destroy(FTextChanged);
|
||||||
|
inherited DetachEvents;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3479,9 +3505,12 @@ begin
|
|||||||
WriteLn('TQtTextEdit.Destroy');
|
WriteLn('TQtTextEdit.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QTextEdit_destroy(QTextEditH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QTextEdit_destroy(QTextEditH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3588,9 +3617,12 @@ begin
|
|||||||
WriteLn('TQtTabWidget.Destroy');
|
WriteLn('TQtTabWidget.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QTabWidget_destroy(QTabWidgetH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QTabWidget_destroy(QTabWidgetH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3724,9 +3756,12 @@ begin
|
|||||||
WriteLn('TQtComboBox.Destroy');
|
WriteLn('TQtComboBox.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QComboBox_destroy(QComboBoxH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QComboBox_destroy(QComboBoxH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3835,9 +3870,12 @@ begin
|
|||||||
WriteLn('TQtAbstractSpinBox.Destroy');
|
WriteLn('TQtAbstractSpinBox.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QAbstractSpinBox_destroy(QAbstractSpinBoxH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QAbstractSpinBox_destroy(QAbstractSpinBoxH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4005,9 +4043,12 @@ begin
|
|||||||
WriteLn('TQtListWidget.Destroy');
|
WriteLn('TQtListWidget.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QListWidget_destroy(QListWidgetH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QListWidget_destroy(QListWidgetH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4150,13 +4191,33 @@ begin
|
|||||||
WriteLn('TQtHeaderView.Destroy');
|
WriteLn('TQtHeaderView.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QHeaderView_destroy(QHeaderViewH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QHeaderView_destroy(QHeaderViewH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TQtHeaderView.AttachEvents;
|
||||||
|
var
|
||||||
|
Method: TMethod;
|
||||||
|
begin
|
||||||
|
inherited AttachEvents;
|
||||||
|
FSelectionClicked := QHeaderView_hook_create(Widget);
|
||||||
|
|
||||||
|
QHeaderView_sectionClicked_Event(Method) := SignalSectionClicked;
|
||||||
|
QHeaderView_hook_hook_sectionClicked(FSelectionClicked, Method);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQtHeaderView.DetachEvents;
|
||||||
|
begin
|
||||||
|
QHeaderView_hook_destroy(FSelectionClicked);
|
||||||
|
inherited DetachEvents;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: TQtHeaderView.SignalSectionClicked
|
Function: TQtHeaderView.SignalSectionClicked
|
||||||
Params: None
|
Params: None
|
||||||
@ -4213,9 +4274,12 @@ begin
|
|||||||
WriteLn('TQtTreeView.Destroy');
|
WriteLn('TQtTreeView.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QTreeView_destroy(QTreeViewH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QTreeView_destroy(QTreeViewH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4231,8 +4295,6 @@ end;
|
|||||||
function TQtTreeWidget.CreateWidget(const AParams: TCreateParams):QWidgetH;
|
function TQtTreeWidget.CreateWidget(const AParams: TCreateParams):QWidgetH;
|
||||||
var
|
var
|
||||||
Parent: QWidgetH;
|
Parent: QWidgetH;
|
||||||
Hook: QHeaderView_hookH;
|
|
||||||
Method: TMethod;
|
|
||||||
begin
|
begin
|
||||||
// Creates the widget
|
// Creates the widget
|
||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
@ -4242,16 +4304,7 @@ begin
|
|||||||
Result := QTreeWidget_create(Parent);
|
Result := QTreeWidget_create(Parent);
|
||||||
|
|
||||||
Header := TQtHeaderView.Create(LCLObject, AParams);
|
Header := TQtHeaderView.Create(LCLObject, AParams);
|
||||||
|
Header.AttachEvents;
|
||||||
Hook := QHeaderView_hook_create(Header.Widget);
|
|
||||||
|
|
||||||
TEventFilterMethod(Method) := Header.EventFilter;
|
|
||||||
|
|
||||||
QObject_hook_hook_events(Hook, Method);
|
|
||||||
|
|
||||||
QHeaderView_sectionClicked_Event(Method) := Header.SignalSectionClicked;
|
|
||||||
QHeaderView_hook_hook_sectionClicked(QHeaderView_hook_create(Header.Widget), Method);
|
|
||||||
|
|
||||||
|
|
||||||
QTreeView_setHeader(QTreeViewH(Result), QHeaderViewH(Header.Widget));
|
QTreeView_setHeader(QTreeViewH(Result), QHeaderViewH(Header.Widget));
|
||||||
end;
|
end;
|
||||||
@ -4270,9 +4323,12 @@ begin
|
|||||||
if Assigned(Header) then
|
if Assigned(Header) then
|
||||||
Header.Free;
|
Header.Free;
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QTreeWidget_destroy(QTreeWidgetH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QTreeWidget_destroy(QTreeWidgetH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4819,9 +4875,12 @@ begin
|
|||||||
WriteLn('TQtProgressBar.Destroy');
|
WriteLn('TQtProgressBar.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QProgressBar_destroy(QProgressBarH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QProgressBar_destroy(QProgressBarH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4922,9 +4981,12 @@ begin
|
|||||||
WriteLn('TQtStatusBar.Destroy');
|
WriteLn('TQtStatusBar.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QStatusBar_destroy(QStatusBarH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QStatusBar_destroy(QStatusBarH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4943,9 +5005,12 @@ end;
|
|||||||
|
|
||||||
destructor TQtDialog.Destroy;
|
destructor TQtDialog.Destroy;
|
||||||
begin
|
begin
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QDialog_destroy(QDialogH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QDialog_destroy(QDialogH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -4992,9 +5057,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
DetachEvents;
|
DetachEvents;
|
||||||
QAbstractScrollArea_destroy(QAbstractScrollAreaH(Widget));
|
QAbstractScrollArea_destroy(QAbstractScrollAreaH(Widget));
|
||||||
|
Widget := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Widget := nil;
|
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -5226,9 +5290,12 @@ begin
|
|||||||
{$ifdef VerboseQt}
|
{$ifdef VerboseQt}
|
||||||
WriteLn('TQtCalendar.Destroy');
|
WriteLn('TQtCalendar.Destroy');
|
||||||
{$endif}
|
{$endif}
|
||||||
DetachEvents;
|
if Widget <> nil then
|
||||||
QCalendarWidget_destroy(QCalendarWidgetH(Widget));
|
begin
|
||||||
Widget := nil;
|
DetachEvents;
|
||||||
|
QCalendarWidget_destroy(QCalendarWidgetH(Widget));
|
||||||
|
Widget := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user