Mercurial > dwindows
comparison android/dw.cpp @ 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 | cd9d2ba251d5 |
children | bb75e64e6138 |
comparison
equal
deleted
inserted
replaced
2538:1b3b40c89cd0 | 2539:822f814a54f4 |
---|---|
3431 { | 3431 { |
3432 jobject jbitmap = _dw_jbitmap_new(width, height, nullptr, nullptr, 0, 0); | 3432 jobject jbitmap = _dw_jbitmap_new(width, height, nullptr, nullptr, 0, 0); |
3433 | 3433 |
3434 if(jbitmap) | 3434 if(jbitmap) |
3435 { | 3435 { |
3436 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP)); | 3436 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
3437 | 3437 |
3438 if(pixmap) | 3438 if(pixmap) |
3439 { | 3439 { |
3440 pixmap->width = width; | 3440 pixmap->width = width; |
3441 pixmap->height = height; | 3441 pixmap->height = height; |
3462 { | 3462 { |
3463 jobject jbitmap = _dw_jbitmap_new(0, 0, filename, nullptr, 0, 0); | 3463 jobject jbitmap = _dw_jbitmap_new(0, 0, filename, nullptr, 0, 0); |
3464 | 3464 |
3465 if(jbitmap) | 3465 if(jbitmap) |
3466 { | 3466 { |
3467 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP)); | 3467 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
3468 | 3468 |
3469 if(pixmap) | 3469 if(pixmap) |
3470 { | 3470 { |
3471 pixmap->bitmap = jbitmap; | 3471 pixmap->bitmap = jbitmap; |
3472 pixmap->handle = handle; | 3472 pixmap->handle = handle; |
3492 { | 3492 { |
3493 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, data, len, 0); | 3493 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, data, len, 0); |
3494 | 3494 |
3495 if(jbitmap) | 3495 if(jbitmap) |
3496 { | 3496 { |
3497 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP)); | 3497 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
3498 | 3498 |
3499 if(pixmap) | 3499 if(pixmap) |
3500 { | 3500 { |
3501 pixmap->bitmap = jbitmap; | 3501 pixmap->bitmap = jbitmap; |
3502 pixmap->handle = handle; | 3502 pixmap->handle = handle; |
3533 { | 3533 { |
3534 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, nullptr, 0, (int)resid); | 3534 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, nullptr, 0, (int)resid); |
3535 | 3535 |
3536 if(jbitmap) | 3536 if(jbitmap) |
3537 { | 3537 { |
3538 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(HPIXMAP)); | 3538 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
3539 | 3539 |
3540 if(pixmap) | 3540 if(pixmap) |
3541 { | 3541 { |
3542 pixmap->bitmap = jbitmap; | 3542 pixmap->bitmap = jbitmap; |
3543 pixmap->handle = handle; | 3543 pixmap->handle = handle; |