mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1236654 - Properly shut down GLController on nsWindow closing; r=snorp
When nsWindow closes, notify GLController to shut down. To ensure any pending calls on the UI thread are processed first, post a Runnable to the UI thread that disposes the GLController on the UI thread.
This commit is contained in:
parent
e2aca4db00
commit
17cdf6a53d
@ -293,6 +293,20 @@ public class GLController extends JNIObject {
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
private void destroy() {
|
||||
// The nsWindow has been closed. First mark our compositor as destroyed.
|
||||
mCompositorCreated = false;
|
||||
|
||||
// Then clear out any pending calls on the UI thread by disposing on the UI thread.
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GLController.this.disposeNative();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class GLControllerException extends RuntimeException {
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -1253,6 +1253,14 @@ auto GLController::CreateEGLSurface() const -> mozilla::jni::Object::LocalRef
|
||||
return mozilla::jni::Method<CreateEGLSurface_t>::Call(this, nullptr);
|
||||
}
|
||||
|
||||
constexpr char GLController::Destroy_t::name[];
|
||||
constexpr char GLController::Destroy_t::signature[];
|
||||
|
||||
auto GLController::Destroy() const -> void
|
||||
{
|
||||
return mozilla::jni::Method<Destroy_t>::Call(this, nullptr);
|
||||
}
|
||||
|
||||
constexpr char GLController::DisposeNative_t::name[];
|
||||
constexpr char GLController::DisposeNative_t::signature[];
|
||||
|
||||
|
@ -3384,6 +3384,23 @@ public:
|
||||
|
||||
auto CreateEGLSurface() const -> mozilla::jni::Object::LocalRef;
|
||||
|
||||
public:
|
||||
struct Destroy_t {
|
||||
typedef GLController Owner;
|
||||
typedef void ReturnType;
|
||||
typedef void SetterType;
|
||||
typedef mozilla::jni::Args<> Args;
|
||||
static constexpr char name[] = "destroy";
|
||||
static constexpr char signature[] =
|
||||
"()V";
|
||||
static const bool isStatic = false;
|
||||
static const bool isMultithreaded = false;
|
||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||
mozilla::jni::ExceptionMode::ABORT;
|
||||
};
|
||||
|
||||
auto Destroy() const -> void;
|
||||
|
||||
public:
|
||||
struct DisposeNative_t {
|
||||
typedef GLController Owner;
|
||||
|
@ -470,11 +470,7 @@ public:
|
||||
|
||||
~GLControllerSupport()
|
||||
{
|
||||
GLController::GlobalRef glController(mozilla::Move(mGLController));
|
||||
nsAppShell::PostEvent([glController] {
|
||||
GLControllerSupport::DisposeNative(GLController::LocalRef(
|
||||
jni::GetGeckoThreadEnv(), glController));
|
||||
});
|
||||
mGLController->Destroy();
|
||||
}
|
||||
|
||||
void Reattach(const GLController::LocalRef& aInstance)
|
||||
|
Loading…
Reference in New Issue
Block a user