Icon View Incident Report

Serious Serious
Reported By: Joachim Mainusch
Reported On: 2/18/2013
For: Version 2.11 Build 3
# 3744 Executing a Stored Procedure that Returns a Cursor Twice Can Cause AV on Second Cursor Close

I have spent now 4 days on a problem with "Invalid pointer operation" or "Access violation at address ....".

The situation:

There is a standard Delphi form (no MDI) with several database bound fields. One of the fields is a TDBLookupCombobox, whose ListSource is a TDataSource that is bound to a TEDBStoredProc component. During the OnShow() event of the form the TEDBStoredProc is "populated".

Everything is working fine. The combobox offers all correct data delivered by the SP.


The problem:

The form can be opened several times (several instances), showing different customer records (customer A in one window, customer B in the 2nd window, etc...). If the form is opened only once and being closed, everything is fine. If more than 1 customer form has been opened and is being closed again (no action needs to be taken at the record!), the program puts out an error message "Invalid pointer operation" or "Access violation at address ....".

In other words:
Form open (record A) - Form close (record A) - OK.
Form open (record A) - Form open (record B) - Form close (record B) - Form close (record A) - ERROR!
Form open (record A) - Form open (record B) - Form open (record C) - Form close (record C) - Form close (record B) - ERROR!

Sometimes after closing all forms and the error occured, when trying to open the form again I get the message "...form already opened...". It seems as if "something" cannot be freed and cleared during the form's closing/destroying. This "something" is the TEDBStoredProc component!

How do I come to this conclusion:
I deleted the TEDBStoredProc component from the form and created it in code instead -> exactly the same problem!
I replaced the TEDBStoredProc component with a TEDBQuery component -> no problem - everything fine!
Without any TEDBStoredProc component (neither on the form, nor as an object in code) -> no problem - everything fine!

CREATE PROCEDURE "KunBriefAnrede2Select" ()
BEGIN
DECLARE procCur CURSOR WITH RETURN FOR procStmt;
PREPARE procStmt FROM
   'SELECT dKUNDEN.BriefAnrede
   FROM dKUNDEN
   GROUP BY dKUNDEN.BriefAnrede
   HAVING (dKUNDEN.BriefAnrede Is Not Null)
   ORDER BY dKUNDEN.BriefAnrede';
OPEN procCur;
END



Comments Comments
The problem was caused by EDB not referencing-counting the return cursor's originating statement properly.


Resolution Resolution
Fixed Problem on 2/20/2013 in version 2.12 build 1


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image