View Issue Details

IDProjectCategoryView StatusLast Update
0027137LazarusPackagespublic2015-01-26 12:29
ReporterBBazAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.7 (SVN)Product Build 
Target Version1.4Fixed in Version1.3 (SVN) 
Summary0027137: AV when pressing ENTER on a TListFilterEdit & TTreeFilterEdit
Descriptionin listfilterededit.pas:
----------------------------------
function TListFilterEdit.ReturnPressed: Boolean;
// Retuns true if the Return press was forwarded to the ListBox
var
  Key: Char;
begin
  Key:=Char(VK_RETURN);
  Result:=Assigned(fFilteredListbox.OnKeyPress);
  if Result then
    fFilteredListbox.OnKeyPress(fFilteredListbox, Key);
end;
----------------------------------

should test if fFilteredListbox is assigned:

----------------------------------
function TListFilterEdit.ReturnPressed: Boolean;
// Retuns true if the Return press was forwarded to the ListBox
var
  Key: Char;
begin
  if fFilteredListbox = nil then
    exit;
  Key:=Char(VK_RETURN);
  Result:=Assigned(fFilteredListbox.OnKeyPress);
  if Result then
    fFilteredListbox.OnKeyPress(fFilteredListbox, Key);
end;
----------------------------------

otherwise an AV is thrown in case of fFilteredListbox is not assigned and if the ENTER key is pressed.
Additional Informationfixed in patch
TagsNo tags attached.
Fixed in Revision47120
LazTarget1.4
Widgetset
Attached Files
  • filter.av.patch.diff (1,264 bytes)
    From 42721f1449f8827eea826efc6df5d577f1ae0926 Mon Sep 17 00:00:00 2001
    From: Basile Burg <basile.burg@gmx.com>
    Date: Sat, 6 Dec 2014 01:44:34 +0100
    Subject: [PATCH] fix filter AV
    
    ---
     components/lazcontrols/listfilteredit.pas | 2 ++
     components/lazcontrols/treefilteredit.pas | 2 ++
     2 files changed, 4 insertions(+)
    
    diff --git a/components/lazcontrols/listfilteredit.pas b/components/lazcontrols/listfilteredit.pas
    index 887b9f2..381974c 100644
    --- a/components/lazcontrols/listfilteredit.pas
    +++ b/components/lazcontrols/listfilteredit.pas
    @@ -277,6 +277,8 @@ function TListFilterEdit.ReturnKeyHandled: Boolean;
     var
       Key: Char;
     begin
    +  if fFilteredListbox = nil then
    +    exit;
       Key:=Char(VK_RETURN);
       Result:=Assigned(fFilteredListbox.OnKeyPress);
       if Result then
    diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas
    index d47b4b0..bc50897 100644
    --- a/components/lazcontrols/treefilteredit.pas
    +++ b/components/lazcontrols/treefilteredit.pas
    @@ -622,6 +622,8 @@ function TTreeFilterEdit.ReturnKeyHandled: Boolean;
     var
       Key: Char;
     begin
    +  if fFilteredTreeview = nil then
    +    exit;
       Key:=Char(VK_RETURN);
       Result:=Assigned(fFilteredTreeview.OnKeyPress);
       if Result then
    -- 
    1.9.4.msysgit.2
    
    
    filter.av.patch.diff (1,264 bytes)
  • filter.av.patch2.diff (1,278 bytes)
    From 42721f1449f8827eea826efc6df5d577f1ae0926 Mon Sep 17 00:00:00 2001
    From: Basile Burg <basile.burg@gmx.com>
    Date: Sat, 6 Dec 2014 01:44:34 +0100
    Subject: [PATCH] fix filter AV
    
    ---
     components/lazcontrols/listfilteredit.pas | 2 ++
     components/lazcontrols/treefilteredit.pas | 2 ++
     2 files changed, 4 insertions(+)
    
    diff --git a/components/lazcontrols/listfilteredit.pas b/components/lazcontrols/listfilteredit.pas
    index 887b9f2..381974c 100644
    --- a/components/lazcontrols/listfilteredit.pas
    +++ b/components/lazcontrols/listfilteredit.pas
    @@ -277,6 +277,8 @@ function TListFilterEdit.ReturnKeyHandled: Boolean;
     var
       Key: Char;
     begin
    +  if fFilteredListbox = nil then
    +    exit(false);
       Key:=Char(VK_RETURN);
       Result:=Assigned(fFilteredListbox.OnKeyPress);
       if Result then
    diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas
    index d47b4b0..bc50897 100644
    --- a/components/lazcontrols/treefilteredit.pas
    +++ b/components/lazcontrols/treefilteredit.pas
    @@ -622,6 +622,8 @@ function TTreeFilterEdit.ReturnKeyHandled: Boolean;
     var
       Key: Char;
     begin
    +  if fFilteredTreeview = nil then
    +    exit(false);
       Key:=Char(VK_RETURN);
       Result:=Assigned(fFilteredTreeview.OnKeyPress);
       if Result then
    -- 
    1.9.4.msysgit.2
    
    
    filter.av.patch2.diff (1,278 bytes)

Activities

BBaz

2014-12-06 01:47

reporter  

filter.av.patch.diff (1,264 bytes)
From 42721f1449f8827eea826efc6df5d577f1ae0926 Mon Sep 17 00:00:00 2001
From: Basile Burg <basile.burg@gmx.com>
Date: Sat, 6 Dec 2014 01:44:34 +0100
Subject: [PATCH] fix filter AV

---
 components/lazcontrols/listfilteredit.pas | 2 ++
 components/lazcontrols/treefilteredit.pas | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/components/lazcontrols/listfilteredit.pas b/components/lazcontrols/listfilteredit.pas
index 887b9f2..381974c 100644
--- a/components/lazcontrols/listfilteredit.pas
+++ b/components/lazcontrols/listfilteredit.pas
@@ -277,6 +277,8 @@ function TListFilterEdit.ReturnKeyHandled: Boolean;
 var
   Key: Char;
 begin
+  if fFilteredListbox = nil then
+    exit;
   Key:=Char(VK_RETURN);
   Result:=Assigned(fFilteredListbox.OnKeyPress);
   if Result then
diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas
index d47b4b0..bc50897 100644
--- a/components/lazcontrols/treefilteredit.pas
+++ b/components/lazcontrols/treefilteredit.pas
@@ -622,6 +622,8 @@ function TTreeFilterEdit.ReturnKeyHandled: Boolean;
 var
   Key: Char;
 begin
+  if fFilteredTreeview = nil then
+    exit;
   Key:=Char(VK_RETURN);
   Result:=Assigned(fFilteredTreeview.OnKeyPress);
   if Result then
-- 
1.9.4.msysgit.2

filter.av.patch.diff (1,264 bytes)

BBaz

2014-12-06 01:57

reporter  

filter.av.patch2.diff (1,278 bytes)
From 42721f1449f8827eea826efc6df5d577f1ae0926 Mon Sep 17 00:00:00 2001
From: Basile Burg <basile.burg@gmx.com>
Date: Sat, 6 Dec 2014 01:44:34 +0100
Subject: [PATCH] fix filter AV

---
 components/lazcontrols/listfilteredit.pas | 2 ++
 components/lazcontrols/treefilteredit.pas | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/components/lazcontrols/listfilteredit.pas b/components/lazcontrols/listfilteredit.pas
index 887b9f2..381974c 100644
--- a/components/lazcontrols/listfilteredit.pas
+++ b/components/lazcontrols/listfilteredit.pas
@@ -277,6 +277,8 @@ function TListFilterEdit.ReturnKeyHandled: Boolean;
 var
   Key: Char;
 begin
+  if fFilteredListbox = nil then
+    exit(false);
   Key:=Char(VK_RETURN);
   Result:=Assigned(fFilteredListbox.OnKeyPress);
   if Result then
diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas
index d47b4b0..bc50897 100644
--- a/components/lazcontrols/treefilteredit.pas
+++ b/components/lazcontrols/treefilteredit.pas
@@ -622,6 +622,8 @@ function TTreeFilterEdit.ReturnKeyHandled: Boolean;
 var
   Key: Char;
 begin
+  if fFilteredTreeview = nil then
+    exit(false);
   Key:=Char(VK_RETURN);
   Result:=Assigned(fFilteredTreeview.OnKeyPress);
   if Result then
-- 
1.9.4.msysgit.2

filter.av.patch2.diff (1,278 bytes)

BBaz

2014-12-06 01:59

reporter   ~0079667

"filter.av.patch2.diff" is the good one. The first patch didn't returned anything.

Jesus Reyes

2014-12-06 04:45

developer   ~0079669

Applied, thanks.

Issue History

Date Modified Username Field Change
2014-12-06 01:47 BBaz New Issue
2014-12-06 01:47 BBaz File Added: filter.av.patch.diff
2014-12-06 01:57 BBaz File Added: filter.av.patch2.diff
2014-12-06 01:59 BBaz Note Added: 0079667
2014-12-06 04:45 Jesus Reyes Fixed in Revision => 47120
2014-12-06 04:45 Jesus Reyes LazTarget => 1.4
2014-12-06 04:45 Jesus Reyes Note Added: 0079669
2014-12-06 04:45 Jesus Reyes Status new => resolved
2014-12-06 04:45 Jesus Reyes Fixed in Version => 1.3 (SVN)
2014-12-06 04:45 Jesus Reyes Resolution open => fixed
2014-12-06 04:45 Jesus Reyes Assigned To => Jesus Reyes
2014-12-06 04:45 Jesus Reyes Target Version => 1.4
2015-01-26 12:29 BBaz Status resolved => closed