changeset 2539:822f814a54f4

Android: Fix memory corruption issue due to incorrectly allocating HPIXMAP. Also call DWRender.invalidate() from the main thread incase it wants to cause an immediate onDraw() ... but we don't need to wait for it.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 12 May 2021 06:17:22 +0000
parents 1b3b40c89cd0
children 1c17472a175a
files android/DWindows.kt android/dw.cpp
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/android/DWindows.kt	Tue May 11 22:53:29 2021 +0000
+++ b/android/DWindows.kt	Wed May 12 06:17:22 2021 +0000
@@ -1835,7 +1835,9 @@
 
     fun renderRedraw(render: DWRender)
     {
-        render.invalidate()
+        runOnUiThread {
+            render.invalidate()
+        }
     }
 
     fun pixmapBitBlt(dstr: DWRender?, dstp: Bitmap?, dstx: Int, dsty: Int, dstw: Int, dsth: Int,
--- a/android/dw.cpp	Tue May 11 22:53:29 2021 +0000
+++ b/android/dw.cpp	Wed May 12 06:17:22 2021 +0000
@@ -3433,7 +3433,7 @@
 
     if(jbitmap)
     {
-        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP));
+        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap));
 
         if(pixmap)
         {
@@ -3464,7 +3464,7 @@
 
     if(jbitmap)
     {
-        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP));
+        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap));
 
         if(pixmap)
         {
@@ -3494,7 +3494,7 @@
 
     if(jbitmap)
     {
-        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP));
+        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap));
 
         if(pixmap)
         {
@@ -3535,7 +3535,7 @@
 
     if(jbitmap)
     {
-        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP));
+        HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap));
 
         if(pixmap)
         {