From: Trent G. <tr...@us...> - 2013-03-30 23:55:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Allegro". The branch, 5.1 has been updated via 29bc4fbc3c40fedd5fa4f60612d60e02fc31f54e (commit) via a370d1f0292fbf99c25179636b71759651d092ad (commit) from 5f50bd41416cf7599ab25b63850befd84e36fb87 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 29bc4fbc3c40fedd5fa4f60612d60e02fc31f54e Author: Trent Gamblin <tr...@us...> Date: Sat Mar 30 17:54:40 2013 -0600 Remove a comment that no longer makes sense. commit a370d1f0292fbf99c25179636b71759651d092ad Author: Trent Gamblin <tr...@us...> Date: Sat Mar 30 17:54:16 2013 -0600 Fix some Android switch in/out and exit issues. ----------------------------------------------------------------------- Summary of changes: .../src/org/liballeg/app/AllegroActivity.java | 3 +- include/allegro5/internal/aintern_android.h | 1 + src/android/android_display.c | 24 ++++++++++--------- src/display.c | 9 ++++++- src/linux/lmseev.c | 1 - 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/android-project/src/org/liballeg/app/AllegroActivity.java b/android-project/src/org/liballeg/app/AllegroActivity.java index cbf0f86..fb94681 100644 --- a/android-project/src/org/liballeg/app/AllegroActivity.java +++ b/android-project/src/org/liballeg/app/AllegroActivity.java @@ -248,7 +248,7 @@ public class AllegroActivity extends Activity implements SensorEventListener surface = null; } - public void postDestroySurface(View s) + public void postDestroySurface() { try { Log.d("AllegroActivity", "postDestroySurface"); @@ -358,6 +358,7 @@ public class AllegroActivity extends Activity implements SensorEventListener public void run() { try { AllegroActivity.this.finish(); + System.exit(0); } catch(Exception x) { Log.d("AllegroActivity", "inner exception: " + x.getMessage()); } diff --git a/include/allegro5/internal/aintern_android.h b/include/allegro5/internal/aintern_android.h index af37aec..94f2771 100644 --- a/include/allegro5/internal/aintern_android.h +++ b/include/allegro5/internal/aintern_android.h @@ -29,6 +29,7 @@ typedef struct ALLEGRO_DISPLAY_ANDROID { bool resize_acknowledge2; bool resumed; bool failed; + bool is_destroy_display; } ALLEGRO_DISPLAY_ANDROID; ALLEGRO_SYSTEM_INTERFACE *_al_system_android_interface(); diff --git a/src/android/android_display.c b/src/android/android_display.c index c551da5..c399f61 100644 --- a/src/android/android_display.c +++ b/src/android/android_display.c @@ -82,9 +82,13 @@ JNI_FUNC(bool, AllegroSurface, nativeOnDestroy, (JNIEnv *env, jobject obj)) ALLEGRO_DEBUG("Display creation failed, not sending HALT"); return false; } - + display->created = false; + if (display->is_destroy_display) { + return true; + } + ALLEGRO_DEBUG("locking display event source: %p %p", d, &d->es); _al_event_source_lock(&d->es); @@ -264,7 +268,7 @@ void _al_android_destroy_surface(JNIEnv *env, jobject surface, bool post) { (void)surface; if (post) { - _jni_callVoidMethodV(env, _al_android_activity_object(), "postDestroySurface", "(Landroid/view/View;)V"); + _jni_callVoidMethodV(env, _al_android_activity_object(), "postDestroySurface", "()V"); } else { _jni_callVoidMethodV(env, _al_android_activity_object(), "destroySurface", "()V"); @@ -567,12 +571,15 @@ static void android_destroy_display(ALLEGRO_DISPLAY *dpy) _al_android_clear_current(_al_android_get_jnienv(), d); al_lock_mutex(d->mutex); - + + d->is_destroy_display = true; + _al_android_destroy_surface(_al_android_get_jnienv(), d, true); - /* I don't think we can use a condition for this, because there are two possibilities - * of how a nativeOnDestroy/surfaceDestroyed callback can be called. One is from here, - * manually, and one happens automatically and is out of our hands. + /* I don't think we can use a condition for this, because there are two + * possibilities of how a nativeOnDestroy/surfaceDestroyed callback can be + * called. One is from here, manually, and one happens automatically and is + * out of our hands. */ while (d->created) { al_rest(0.001); @@ -580,11 +587,6 @@ static void android_destroy_display(ALLEGRO_DISPLAY *dpy) _al_event_source_free(&dpy->es); - if (dpy->flags & ALLEGRO_PROGRAMMABLE_PIPELINE && dpy->default_shader) { - al_destroy_shader(dpy->default_shader); - dpy->default_shader = NULL; - } - // XXX: this causes a crash, no idea why as of yet //ALLEGRO_DEBUG("destroy backbuffer"); //_al_ogl_destroy_backbuffer(al_get_backbuffer(dpy)); diff --git a/src/display.c b/src/display.c index 92dd36c..5e9aca9 100644 --- a/src/display.c +++ b/src/display.c @@ -1,5 +1,5 @@ /* ______ ___ ___ - * /\ _ \ /\_ \ /\_ \ + * /\ _ \ /\_ \ /\_ \ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ @@ -142,6 +142,12 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) void al_destroy_display(ALLEGRO_DISPLAY *display) { if (display) { + /* This causes warnings and potential errors on Android because + * it clears the context and Android needs this thread to have + * the context bound in its destroy function and to destroy the + * shader. Just skip this part on Android. + */ +#ifndef ALLEGRO_ANDROID ALLEGRO_BITMAP *bmp; bmp = al_get_target_bitmap(); @@ -153,6 +159,7 @@ void al_destroy_display(ALLEGRO_DISPLAY *display) */ if (display == al_get_current_display()) _al_set_current_display_only(NULL); +#endif al_destroy_shader(display->default_shader); display->default_shader = NULL; diff --git a/src/linux/lmseev.c b/src/linux/lmseev.c index 5cd4332..458cd39 100644 --- a/src/linux/lmseev.c +++ b/src/linux/lmseev.c @@ -644,7 +644,6 @@ static unsigned int mouse_get_mouse_num_axes(void) */ static bool mouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) { - /* FIXME: should these do something? */ (void)display; _al_event_source_lock(&the_mouse.parent.es); hooks/post-receive -- Allegro |