Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt);
Thanks Robert! > So your solution is to NULL your pointer after calling finalize() and don't > call finalize() again if your pointer is NULL. I think I need to do so. Again thanks, JP - Original Message From: Robert Simpson <[EMAIL PROTECTED]> To: General Discussion of SQLite Database Sent: Thursday, September 18, 2008 8:54:49 AM Subject: Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt); You can't. The memory pStmt points to is freed and invalid after the call to finalize. Worse, that freed memory could've already been reallocated for some other purpose by the time the call to finalize() returns control to you. So your solution is to NULL your pointer after calling finalize() and don't call finalize() again if your pointer is NULL. Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joanne Pham Sent: Thursday, September 18, 2008 8:44 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. I think I called sqlite3_finalize(pStmt) twice so my application is crashed. Thanks, JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: General Discussion of SQLite Database Sent: Wednesday, September 17, 2008 10:14:18 AM Subject: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, I have c++ application which is used SQLite 3.5.9. Occasionally the application is crash on sqlite3_finalize(pStmt); Is that true the sqlite3_finalize(pStmt) invoked twice? How to avoid this crashed problem? How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. Thanks, JP ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt);
Or to simply not release the same resource twice. That is clearly a bug - the control flow in your application is incorrect if it does this. You could work around it with the NULL value hack if you're short on time, but I recommend trying to find out why this happens since bugs like these might come back and bite you in the ass when you least expect it... Robert Simpson wrote: You can't. The memory pStmt points to is freed and invalid after the call to finalize. Worse, that freed memory could've already been reallocated for some other purpose by the time the call to finalize() returns control to you. So your solution is to NULL your pointer after calling finalize() and don't call finalize() again if your pointer is NULL. Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joanne Pham Sent: Thursday, September 18, 2008 8:44 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. I think I called sqlite3_finalize(pStmt) twice so my application is crashed. Thanks, JP ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt);
You can't. The memory pStmt points to is freed and invalid after the call to finalize. Worse, that freed memory could've already been reallocated for some other purpose by the time the call to finalize() returns control to you. So your solution is to NULL your pointer after calling finalize() and don't call finalize() again if your pointer is NULL. Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joanne Pham Sent: Thursday, September 18, 2008 8:44 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. I think I called sqlite3_finalize(pStmt) twice so my application is crashed. Thanks, JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: General Discussion of SQLite Database Sent: Wednesday, September 17, 2008 10:14:18 AM Subject: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, I have c++ application which is used SQLite 3.5.9. Occasionally the application is crash on sqlite3_finalize(pStmt); Is that true the sqlite3_finalize(pStmt) invoked twice? How to avoid this crashed problem? How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. Thanks, JP ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Program is crashed on sqlite3_finalize(pStmt);
Hi All, How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. I think I called sqlite3_finalize(pStmt) twice so my application is crashed. Thanks, JP - Original Message From: Joanne Pham <[EMAIL PROTECTED]> To: General Discussion of SQLite Database Sent: Wednesday, September 17, 2008 10:14:18 AM Subject: [sqlite] Program is crashed on sqlite3_finalize(pStmt); Hi All, I have c++ application which is used SQLite 3.5.9. Occasionally the application is crash on sqlite3_finalize(pStmt); Is that true the sqlite3_finalize(pStmt) invoked twice? How to avoid this crashed problem? How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. Thanks, JP ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Program is crashed on sqlite3_finalize(pStmt);
Hi All, I have c++ application which is used SQLite 3.5.9. Occasionally the application is crash on ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users sqlite3_finalize(pStmt); Is that true the sqlite3_finalize(pStmt) invoked twice? How to avoid this crashed problem? How to check if the pStmt is not finalize so sqlite3_finalize(pStmt) can be call again. Thanks, JP ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users