changeset 2633:3d20fcfd8583

Android: Fix startup failure when not calling dw_app_id_set(). dw_init() would have an exception with no application name. So create a default application name with getprogname().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 09 Aug 2021 22:07:54 +0000
parents 04d5c8147e33
children 4d1bcfc617b2
files android/dw.cpp style.txt
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/android/dw.cpp	Tue Aug 03 19:48:02 2021 +0000
+++ b/android/dw.cpp	Mon Aug 09 22:07:54 2021 +0000
@@ -7057,6 +7057,13 @@
         /* Generate an Application ID based on the PID if all else fails. */
         snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
     }
+    if(!_dw_app_name[0])
+    {
+        const char *name = getprogname();
+
+        if(name)
+            strncpy(_dw_app_name, name, _DW_APP_ID_SIZE);
+    }
 
     if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
     {
--- a/style.txt	Tue Aug 03 19:48:02 2021 +0000
+++ b/style.txt	Mon Aug 09 22:07:54 2021 +0000
@@ -55,7 +55,7 @@
 
 These functions, variables and constants are used only inside Dynamic Windows, or the platform they are defined in.
 
-Funtion prefix: _dw_ (lowercase)
+Function prefix: _dw_ (lowercase)
 Variable prefix: _dw_ (lowercase)
 Constant prefix: _DW_ (uppercase)