mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-12 21:20:31 +01:00
Qt: fix possible caret crash
git-svn-id: trunk@12246 -
This commit is contained in:
parent
946941c1a6
commit
1fdddb7bd2
@ -341,7 +341,6 @@ end;
|
|||||||
|
|
||||||
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if (FWidget = nil) or (FWidget.Widget = nil) then
|
if (FWidget = nil) or (FWidget.Widget = nil) then
|
||||||
begin
|
begin
|
||||||
FPos.X := 0;
|
FPos.X := 0;
|
||||||
@ -438,13 +437,13 @@ procedure TEmulatedCaret.UpdateCaret;
|
|||||||
var
|
var
|
||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
if (FWidget <> nil) and (FWidget.Widget <> nil) then
|
if (FWidget <> nil) then
|
||||||
begin
|
begin
|
||||||
R.Left := FPos.x;
|
R.Left := FPos.x;
|
||||||
R.Top := FPos.y;
|
R.Top := FPos.y;
|
||||||
R.Right := R.Left + FWidth + 2;
|
R.Right := R.Left + FWidth + 2;
|
||||||
R.Bottom := R.Top + FHeight + 2;
|
R.Bottom := R.Top + FHeight + 2;
|
||||||
if FWidget.Context = 0 then
|
if (FWidget.Context = 0) and (FWidget.Widget <> nil) then
|
||||||
begin
|
begin
|
||||||
if not EqualRect(FOldRect, R) then
|
if not EqualRect(FOldRect, R) then
|
||||||
FWidget.Update(@FOldRect);
|
FWidget.Update(@FOldRect);
|
||||||
|
|||||||
@ -1123,6 +1123,9 @@ begin
|
|||||||
|
|
||||||
QCursor_destroy(FDefaultCursor);
|
QCursor_destroy(FDefaultCursor);
|
||||||
|
|
||||||
|
if HasCaret then
|
||||||
|
DestroyCaret;
|
||||||
|
|
||||||
if (Widget <> nil) and FOwnWidget then
|
if (Widget <> nil) and FOwnWidget then
|
||||||
QWidget_destroy(QWidgetH(Widget));
|
QWidget_destroy(QWidgetH(Widget));
|
||||||
Widget := nil;
|
Widget := nil;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user