This commit is contained in:
2026-03-18 07:56:17 +01:00
parent c50267120a
commit 9bdc4ba894
2 changed files with 16 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include <QThread> #include <QThread>
#include <QFile> #include <QFile>
#include <QApplication>
static int _argc; static int _argc;
static char **_argv; static char **_argv;
@@ -87,4 +88,7 @@ int main(int argc, char *argv[])
rkt_webview_close(wv1); rkt_webview_close(wv1);
rkt_webview_cleanup(); rkt_webview_cleanup();
} }
QCoreApplication *app = QApplication::instance();
delete app;
printf("%p\n", QApplication::instance());
} }

View File

@@ -24,6 +24,17 @@ uint64_t current_ms() {
Rktwebview_qt *handler = nullptr; Rktwebview_qt *handler = nullptr;
void destroyApp()
{
if (handler != nullptr) {
QCoreApplication *app = QApplication::instance();
if (app != nullptr) {
app->exit(0);
delete app;
}
}
}
void rkt_webview_cleanup() void rkt_webview_cleanup()
{ {
if (handler != nullptr) { if (handler != nullptr) {
@@ -58,6 +69,7 @@ void rkt_webview_init()
//fprintf(stderr, "init: handler = %p\n", handler); //fprintf(stderr, "init: handler = %p\n", handler);
handler = new Rktwebview_qt(); handler = new Rktwebview_qt();
//fprintf(stderr, "init: handler = %p\n", handler); //fprintf(stderr, "init: handler = %p\n", handler);
atexit(destroyApp);
} }
if (handler->app() == nullptr) { if (handler->app() == nullptr) {