From 20fdb92c777945d610dd14a3058689abf83eaf43 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Thu, 12 Feb 2015 07:41:44 +0000 Subject: QuickSearch: possible crash avoiding fix git-svn-id: http://svn.miranda-ng.org/main/trunk@12092 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickSearch/sr_window.pas | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'plugins/QuickSearch/sr_window.pas') diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index 16aa74bd2d..fa2a983367 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -1191,21 +1191,23 @@ begin KillTimer(Dialog,TIMERID_HOVER); if GetForegroundWindow<>mainwnd then exit; i:=LV_GetLParam(grid,OldHItem); - FillChar(info,SizeOf(info),0); - with info do + if i>=0 then begin - cbSize :=SizeOf(info); - hItem :=FlagBuf[i].contact; - GetCursorPos(ptCursor); - tmpCursor :=ptCursor; + FillChar(info,SizeOf(info),0); + with info do + begin + cbSize :=SizeOf(info); + hItem :=FlagBuf[i].contact; + GetCursorPos(ptCursor); + tmpCursor :=ptCursor; { - ptCursor.x:=loword(lParam); - ptCursor.y:=hiword(lParam); + ptCursor.x:=loword(lParam); + ptCursor.y:=hiword(lParam); } - SendMessage(grid,LVM_GETITEMRECT,OldHItem,tlparam(@rcItem)); - ScreenToClient(grid,tmpCursor); - if not PtInRect(rcItem,tmpCursor) then exit; - end; + SendMessage(grid,LVM_GETITEMRECT,OldHItem,tlparam(@rcItem)); + ScreenToClient(grid,tmpCursor); + if not PtInRect(rcItem,tmpCursor) then exit; + end; // mGetMem(txt,16384*SizeOf(WideChar)); { p:=txt; @@ -1240,9 +1242,10 @@ end; end; p^:=#0; } - CallService(MS_TIPPER_SHOWTIPW,0{twparam(txt)},tlparam(@info)); + CallService(MS_TIPPER_SHOWTIPW,0{twparam(txt)},tlparam(@info)); // mFreeMem(txt); - TTShowed:=true; + TTShowed:=true; + end; end; end; -- cgit v1.2.3