Crashing on close

Bart Pietercil bart.pietercil at gmail.com
Mon Feb 26 11:52:28 CST 2007


Hi List,

why would this crash?

Sub Action()
   Dim myFile As FolderItem
   Dim myCursor As VCursor
   Dim i As integer
   Dim CoReConnectionDB As VDatabase
   Dim ValidUntil,ValidFrom As Date

   myFile = GetOpenFolderItem(ft_core.ConnectionFile)

   if myFile <> Nil then

     Valentina.Init(3*1024*1024,"yeah","yeah")

     Try
       CoReConnectionDB = new VDatabase
       CoReConnectionDB.UseEncryptionKey 
("somekey",EVDataKind.kStructureAndRecords)
       CoReConnectionDB.Open(myFile)
       myCursor = CoReConnectionDB.SqlSelect("SELECT * FROM  
connectioninfo")
       if myCursor <> Nil Then
         if myCursor.FirstRecord Then
           do
             ConnectionInfo = new Dictionary
             for i = 1 to myCursor.FieldCount
               ConnectionInfo.Value(myCursor.Field(i).Name) =  
myCursor.Field(i).Value
             Next
           loop until not myCursor.NextRecord
           ValidUntil = new Date
           ValidUntil.SQLDate = ConnectionInfo.Value 
("connectend").StringValue
           ValidFrom = new Date
           ValidFrom.SQLDate = ConnectionInfo.Value 
("connectstart").StringValue

           if ValidFrom <= new Date then//correct
             if ValidUntil >= new Date then
               myCursor = Nil

               myCursor = CoReConnectionDB.SqlSelect("SELECT * FROM  
contextinfo")
               if myCursor <> Nil Then
                 if myCursor.FirstRecord Then
                   do
                     ContextInfo = new Dictionary
                     for i = 1 to myCursor.FieldCount
                       ContextInfo.Value(myCursor.Field(i).Name) =  
myCursor.Field(i).Value
                     Next
                   loop until not myCursor.NextRecord
                   myCursor = Nil
                   Dim sContextInfo As String

                   sContextInfo= ContextInfo.Value 
("org_name").StringValue + EndOfLine + ContextInfo.Value 
("org_address").StringValue + EndOfLine +_
                   ContextInfo.Value("org_zip").StringValue+ " " +  
ContextInfo.Value("org_city").StringValue
                   fld_contextinfo.Text = sContextInfo
                   pp_login.Value = pp_login.Value + 1
                 end if
               Else
                 MsgBox("De contextinfo van dit bestand is niet  
leesbaar. Selecteer een ander bestand of vraag een nieuw  
connectiebestand aan.")
               end if
             Else
               MsgBox("De geldigheidsdatum van dit connectiebestand  
is verlopen. Selecteer een geldig bestand of vraag een nieuw  
connectiebestand aan.")
             end if

           end if
         end if
       Else
         MsgBox("Dit connectiebestand is niet correct. Vraag een  
nieuw connectiebestand aan.")
         Return
       end if

     Catch Err As VException
       MsgBox("Error while reading ConnectionInfo: " + Err.Message)
     end
   Else
     MsgBox "Zonder een connectiebestand kan je niet inloggen op een  
CoRe-Server"
   end if

   CoReConnectionDB.Close--------> crash, when put in a try catch I  
get an empty error message followed by a crash

End Sub

THe data inside the db is read no problem there, it is just when  
closing that it is happening

 From the console I get this



PID:    7688
Thread: 0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0   libvkernel_fat_release.dylib   	0x1452b807 void  
fbl::DbStorage::ForEachTableStorage<std::mem_fun_t<void,  
fbl::I_Storage> >(std::mem_fun_t<void, fbl::I_Storage>, bool, bool) +  
159
1   libvkernel_fat_release.dylib   	0x1431fdf4 fbl::DbStorage::Close 
(bool) + 170
2   libvkernel_fat_release.dylib   	0x14320536  
fbl::DbStorage::~DbStorage [in-charge deleting]() + 56
3   libvkernel_fat_release.dylib   	0x1452b47e fbl::DbStorage::Release 
() const + 34
4   libvkernel_fat_release.dylib   	0x144b1cb5  
fbl::Database_imp::~Database_imp [not-in-charge]() + 771
5   libvkernel_fat_release.dylib   	0x144a9b72  
fbl::vsql::SqlDatabase::~SqlDatabase [in-charge deleting]() + 258
6   libvkernel_fat_release.dylib   	0x1455e273  
fbl::vsql::SqlDatabase::Release() const + 43
7   V4RB.rbx_0.132.dylib           	0x015fecb8  
fbl::smart_ptr<fbl::vsql::I_SqlDatabase>::operator= 
(fbl::vsql::I_SqlDatabase*) + 42
8   V4RB.rbx_0.132.dylib           	0x015c483c Database_Destructor 
(REALobjectStruct*, void*) + 112
9                                  	0x00189222 VDatabase.__exit%% 
o<VDatabase> + 61
10  rbframework.dylib              	0x0047a6d1 RuntimeNewObject + 629
11  rbframework.dylib              	0x0047a80a RuntimeUnlockObject + 38
12                                 	0x000c02ff  
CoReServerLogin.CoReServerLogin.pb_createDataFile_Action%% 
o<CoReServerLogin> + 25660



TIA

Bart Pietercil




More information about the Valentina mailing list