Bugfix for occasional crash executing query.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@24231 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-12-24 08:45:43 +00:00
parent 07b82dba68
commit 08456b4a80
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-12-24 Richard Frith-Macdonald <rfm@gnu.org>
* JDBC.m: Don't store pointer to jni information in local variable
until after we have opened the connection to the database, or we
may be using a null pointer and generate a crash.
2006-12-22 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: save/restore LIBS after jdbc check so that other

9
JDBC.m
View file

@ -1089,7 +1089,7 @@ NSLog(@"CONNECT '%@', '%@', '%@'",
CREATE_AUTORELEASE_POOL(arp);
NSString *stmt = [info objectAtIndex: 0];
JNIEnv *env = SQLClientJNIEnv();
JInfo *ji = (JInfo*)extra;
JInfo *ji;
if ([stmt length] == 0)
{
@ -1121,6 +1121,8 @@ NSLog(@"CONNECT '%@', '%@', '%@'",
[self name], stmt];
}
ji = (JInfo*)extra;
if ([info count] > 1)
{
unsigned i;
@ -1168,6 +1170,7 @@ NSLog(@"CONNECT '%@', '%@', '%@'",
{
if (_inTransaction == NO)
{
ji = (JInfo*)extra;
// Not in a transaction ... rollback to clear error state
(*env)->CallVoidMethod (env, ji->connection, ji->rollback);
JExceptionClear (env);
@ -1193,7 +1196,7 @@ NSLog(@"CONNECT '%@', '%@', '%@'",
NSMutableArray *records = nil;
CREATE_AUTORELEASE_POOL(arp);
JNIEnv *env = SQLClientJNIEnv();
JInfo *ji = (JInfo*)extra;
JInfo *ji;
if ([stmt length] == 0)
{
@ -1229,6 +1232,8 @@ NSLog(@"CONNECT '%@', '%@', '%@'",
[self name], stmt];
}
ji = (JInfo*)extra;
result = (*env)->CallObjectMethod (env, ji->statement, ji->executeQuery,
JStringFromNSString(env, stmt));
JException (env);