void cApplication::run(HINSTANCE hInstance) { initialize(); initException(); setDebugLeakFlag(); if (_getCore()->initialize(hInstance, _wndProc)) { if (initApp()) { MSG msg; while (!m_quit) { while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } procedure(); } } } terminate(); }
/* * Start/continue throwing process now that we have a class reference. */ void dvmThrowChainedExceptionByClass(ClassObject* excepClass, const char* msg, Object* cause) { Thread* self = dvmThreadSelf(); Object* exception; /* make sure the exception is initialized */ if (!dvmIsClassInitialized(excepClass) && !dvmInitClass(excepClass)) { LOGE("ERROR: unable to initialize exception class '%s'\n", excepClass->descriptor); if (strcmp(excepClass->descriptor, "Ljava/lang/InternalError;") == 0) dvmAbort(); dvmThrowChainedException("Ljava/lang/InternalError;", "failed to init original exception class", cause); return; } exception = dvmAllocObject(excepClass, ALLOC_DEFAULT); if (exception == NULL) { /* * We're in a lot of trouble. We might be in the process of * throwing an out-of-memory exception, in which case the * pre-allocated object will have been thrown when our object alloc * failed. So long as there's an exception raised, return and * allow the system to try to recover. If not, something is broken * and we need to bail out. */ if (dvmCheckException(self)) goto bail; LOGE("FATAL: unable to allocate exception '%s' '%s'\n", excepClass->descriptor, msg != NULL ? msg : "(no msg)"); dvmAbort(); } /* * Init the exception. */ if (gDvm.optimizing) { /* need the exception object, but can't invoke interpreted code */ LOGV("Skipping init of exception %s '%s'\n", excepClass->descriptor, msg); } else { assert(excepClass == exception->clazz); if (!initException(exception, msg, cause, self)) { /* * Whoops. If we can't initialize the exception, we can't use * it. If there's an exception already set, the constructor * probably threw an OutOfMemoryError. */ if (!dvmCheckException(self)) { /* * We're required to throw something, so we just * throw the pre-constructed internal error. */ self->exception = gDvm.internalErrorObj; } goto bail; } } self->exception = exception; bail: dvmReleaseTrackedAlloc(exception, self); }