Jon, please correct this

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jul 22 10:41:46 CDT 2004


Hi Jon,

When we create new db in your project,
You start add some records into misc table.

I see in the log file strange order of creation/destruction of cursors.

Cursor_Ctor...
    PARAM: instance = 26792288
    PARAM: inDB = 26796632
    PARAM: inSQLstr = "select * from misc where RecId=0"
    PARAM: inCursorLocation = 2
    PARAM: inCursorType = 3
    PARAM: inDirection = 1
return

> Cursor_Destructor...
>   PARAM: instance = 26690640
> return
> 
> Field_Destructor...
>   PARAM: inFld = 26984016
>   VAR: data->mpField = 0
> return
> 
> Field_Destructor...
>   PARAM: inFld = 26984108
>   VAR: data->mpField = 0
> return
> 
> Field_Destructor...
>   PARAM: inFld = 26984064
>   VAR: data->mpField = 0
> return

Cursor_SetRecBlank...
    PARAM: inCursor = 26792288
return

Cursor_GetFieldByName...
    PARAM: inCursor = 26792288
    PARAM: inName = "minimumVersionRequired"
return object = 26984064

Field_SetString...
    PARAM: inFld = 26984064
    PARAM: inValue = "800"
return

Cursor_AddRecord...
    PARAM: inCursor = 26792288
return (int) res = 1


In the blue color above you see that when you have create one cursor the
previous start to die.

I am sure that you have code BY LOGIC as next

    curs = db.SqlSelect()
    ...

    curs = db.SqlSelect()


This is correct code from point of view of REALbasic, but this is not very
good from point of view Valentina, and more correctly say:
        functions that allocates/lock/eat resources

The first cursor LOCK records, so may happens that you simply will not be
able create second cursor because it also will want the same records.

The CORRECT WAY is to free resources ASAP.

    curs = db.SqlSelect()
    ...
    curs = nil  // this will start destructors

    curs = db.SqlSelect()

    curs = nil


Also I think in your code you keep Cursor variable as Window property or may
be application class property. And you have forget to NIL it before you
close db.  This cause now new crash in 2.0 which I will fix now. Although it
still good idea destroy all objects before db.close().

And I will try to add feature that V4RB will write into log WARNING in case
it find object destroyed AFTER db.close().

In any case fix above issue with cursors and send me new project.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina-beta mailing list