mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 03:29:28 +02:00
Qt: fixed crash with checkable listview when item is deleted inside OnItemChecked event. issue #32869
git-svn-id: trunk@56888 -
This commit is contained in:
parent
528fcceaf4
commit
4ebb387946
@ -12827,8 +12827,9 @@ begin
|
|||||||
else
|
else
|
||||||
SetItemLastCheckStateInternal(AItem, QtUnChecked);
|
SetItemLastCheckStateInternal(AItem, QtUnChecked);
|
||||||
|
|
||||||
SendMessage(AItem);
|
// if AItem is deleted in mouse event FDelayedCheckItem becomes nil and that's fine. issue #32869
|
||||||
FDelayedCheckItem := AItem;
|
FDelayedCheckItem := AItem;
|
||||||
|
SendMessage(AItem);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@ -12839,6 +12840,8 @@ begin
|
|||||||
SetItemLastCheckStateInternal(FDelayedCheckItem, QListWidgetItem_checkState(FDelayedCheckItem));
|
SetItemLastCheckStateInternal(FDelayedCheckItem, QListWidgetItem_checkState(FDelayedCheckItem));
|
||||||
SendMessage(FDelayedCheckItem);
|
SendMessage(FDelayedCheckItem);
|
||||||
end;
|
end;
|
||||||
|
if FDelayedCheckItem = nil then // issue #32869
|
||||||
|
exit;
|
||||||
FDelayedCheckItem := nil;
|
FDelayedCheckItem := nil;
|
||||||
SetItemLastCheckStateInternal(AItem, QListWidgetItem_checkState(AItem));
|
SetItemLastCheckStateInternal(AItem, QListWidgetItem_checkState(AItem));
|
||||||
SendMessage(AItem);
|
SendMessage(AItem);
|
||||||
@ -13756,6 +13759,8 @@ begin
|
|||||||
if (getSelectionMode = QAbstractItemViewSingleSelection) then
|
if (getSelectionMode = QAbstractItemViewSingleSelection) then
|
||||||
setCurrentRow(-1);
|
setCurrentRow(-1);
|
||||||
Item := QListWidget_takeitem(QListWidgetH(Widget), AIndex);
|
Item := QListWidget_takeitem(QListWidgetH(Widget), AIndex);
|
||||||
|
if FDelayedCheckItem = Item then
|
||||||
|
FDelayedCheckItem := nil;
|
||||||
QListWidgetItem_destroy(Item);
|
QListWidgetItem_destroy(Item);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -14466,8 +14471,9 @@ begin
|
|||||||
else
|
else
|
||||||
SetItemLastCheckStateInternal(AItem, QtUnChecked);
|
SetItemLastCheckStateInternal(AItem, QtUnChecked);
|
||||||
|
|
||||||
SendMessage(AItem);
|
// if AItem is deleted in mouse event FDelayedCheckItem becomes nil and that's fine. issue #32869
|
||||||
FDelayedCheckItem := AItem;
|
FDelayedCheckItem := AItem;
|
||||||
|
SendMessage(AItem);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@ -14478,6 +14484,8 @@ begin
|
|||||||
SetItemLastCheckStateInternal(FDelayedCheckItem, QTreeWidgetItem_checkState(FDelayedCheckItem, 0));
|
SetItemLastCheckStateInternal(FDelayedCheckItem, QTreeWidgetItem_checkState(FDelayedCheckItem, 0));
|
||||||
SendMessage(FDelayedCheckItem);
|
SendMessage(FDelayedCheckItem);
|
||||||
end;
|
end;
|
||||||
|
if FDelayedCheckItem = nil then // issue #32869
|
||||||
|
exit;
|
||||||
FDelayedCheckItem := nil;
|
FDelayedCheckItem := nil;
|
||||||
SetItemLastCheckStateInternal(AItem, QTreeWidgetItem_checkState(AItem, 0));
|
SetItemLastCheckStateInternal(AItem, QTreeWidgetItem_checkState(AItem, 0));
|
||||||
SendMessage(AItem);
|
SendMessage(AItem);
|
||||||
@ -15001,6 +15009,8 @@ begin
|
|||||||
Index := -1;
|
Index := -1;
|
||||||
if Index <> -1 then
|
if Index <> -1 then
|
||||||
FSelection.Remove(Item);
|
FSelection.Remove(Item);
|
||||||
|
if FDelayedCheckItem = Item then
|
||||||
|
FDelayedCheckItem := nil;
|
||||||
Item := takeTopLevelItem(AIndex);
|
Item := takeTopLevelItem(AIndex);
|
||||||
if Item <> nil then
|
if Item <> nil then
|
||||||
QTreeWidgetItem_destroy(Item);
|
QTreeWidgetItem_destroy(Item);
|
||||||
|
Loading…
Reference in New Issue
Block a user