# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1621324559 0 # Node ID b5e8a319fde689260e397ed6a551e08bccc00cf1 # Parent ebc6a4ff5f1f5238e52ed497df5a925ea7a7b6b6 Android: Fix logic error in dw_container_setup() causing return from the loop that creates the container columns. Also the handles to icons should use strong references not weak. diff -r ebc6a4ff5f1f -r b5e8a319fde6 android/dw.cpp --- a/android/dw.cpp Tue May 18 01:04:52 2021 +0000 +++ b/android/dw.cpp Tue May 18 07:55:59 2021 +0000 @@ -3010,6 +3010,8 @@ */ int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) { + int retval = DW_ERROR_GENERAL; + if(handle && flags && titles && count > 0) { int z; @@ -3020,6 +3022,8 @@ if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { + retval = DW_ERROR_NONE; + // Generate a string jstring jstr = env->NewStringUTF(titles[z]); // First get the class that contains the method you need to call @@ -3029,12 +3033,12 @@ "(Landroid/widget/ListView;Ljava/lang/String;I)V"); // Call the method on the object env->CallVoidMethod(_dw_obj, containerNew, handle, jstr, (int)flags[z]); - if(!_dw_jni_check_exception(env)) - return DW_ERROR_NONE; + if(_dw_jni_check_exception(env)) + retval = DW_ERROR_GENERAL; } } } - return DW_ERROR_GENERAL; + return retval; } /* @@ -3603,7 +3607,7 @@ "(Ljava/lang/String;[BII)Landroid/graphics/drawable/Drawable;"); // Call the method on the object jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, iconNew, - file, bytearray, len, resid), _DW_REFERENCE_WEAK); + file, bytearray, len, resid), _DW_REFERENCE_STRONG); // Clean up after the array now that we are finished //if(bytearray) //env->ReleaseByteArrayElements(bytearray, (jbyte *) data, 0);