Qt: fixed rare crash with QClipboard because we are freeing QClipboardH which is owned by QApplication

git-svn-id: trunk@34640 -
This commit is contained in:
zeljko 2012-01-07 17:14:27 +00:00
parent ba86e46415
commit df8e36b1c7

View File

@ -583,6 +583,7 @@ type
constructor Create; override;
destructor Destroy; override;
procedure AttachEvents; override;
procedure DetachEvents; override;
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
function Clipboard: QClipboardH; inline;
@ -3827,6 +3828,8 @@ begin
FSelTimer.Free;
{$ENDIF}
FClipBoardFormats.Free;
// This is global QApplication object so do NOT destroy it !!
TheObject := nil;
inherited Destroy;
end;
@ -3842,6 +3845,19 @@ begin
{$ENDIF}
end;
procedure TQtClipboard.DetachEvents;
begin
if Assigned(FClipDataChangedHook) then
QClipboard_hook_destroy(FClipDataChangedHook);
FClipDataChangedHook := nil;
{$IFDEF HASX11}
if Assigned(FClipSelectionChangedHook) then
QClipboard_hook_destroy(FClipSelectionChangedHook);
FClipSelectionChangedHook := nil;
{$ENDIF}
inherited DetachEvents;
end;
procedure TQtClipboard.signalDataChanged; cdecl;
begin
{$IFDEF VERBOSE_QT_CLIPBOARD}