mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
Fix cli bridge crash on open
This commit is contained in:
14
applications/external/cli_bridge/cligui_main.c
vendored
14
applications/external/cli_bridge/cligui_main.c
vendored
@@ -2,6 +2,7 @@
|
||||
#include "cli_control.h"
|
||||
#include "text_input.h"
|
||||
#include "console_output.h"
|
||||
#include <loader/loader_i.h>
|
||||
|
||||
static bool cligui_custom_event_cb(void* context, uint32_t event) {
|
||||
UNUSED(event);
|
||||
@@ -69,9 +70,8 @@ int32_t cligui_main(void* p) {
|
||||
// Unlock loader-lock and save app thread
|
||||
FuriThread* temp_save_appthr;
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
Loader_internal* loader_i = (Loader_internal*)loader;
|
||||
temp_save_appthr = loader_i->app.thread;
|
||||
loader_unlock(loader);
|
||||
temp_save_appthr = loader->app.thread;
|
||||
loader->app.thread = NULL;
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
CliguiApp* cligui = malloc(sizeof(CliguiApp));
|
||||
@@ -138,11 +138,9 @@ int32_t cligui_main(void* p) {
|
||||
free(cligui->data);
|
||||
free(cligui);
|
||||
|
||||
// Don't touch system loader!!! We restoring previous app thread here, we love kostily and velosipedy, bydlo kod forever!
|
||||
|
||||
Loader* loader1 = furi_record_open(RECORD_LOADER);
|
||||
Loader_internal* loader_ii = (Loader_internal*)loader1;
|
||||
loader_ii->app.thread = temp_save_appthr;
|
||||
// We restoring previous app thread here, we love kostily and velosipedy, bydlo kod forever!
|
||||
loader = furi_record_open(RECORD_LOADER);
|
||||
loader->app.thread = temp_save_appthr;
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
return 0;
|
||||
|
||||
31
applications/external/cli_bridge/internal_defs.h
vendored
31
applications/external/cli_bridge/internal_defs.h
vendored
@@ -71,35 +71,6 @@ typedef struct {
|
||||
void* input_callback_context;
|
||||
} ViewPort_internal;
|
||||
|
||||
typedef struct {
|
||||
Gui* gui;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
Menu* primary_menu;
|
||||
Submenu* settings_menu;
|
||||
|
||||
void (*closed_callback)(void*);
|
||||
void* closed_callback_context;
|
||||
|
||||
void (*click_callback)(const char*, void*);
|
||||
void* click_callback_context;
|
||||
|
||||
FuriThread* thread;
|
||||
} LoaderMenu_internal;
|
||||
|
||||
typedef struct {
|
||||
char* args;
|
||||
char* name;
|
||||
FuriThread* thread;
|
||||
bool insomniac;
|
||||
} LoaderAppData_internal;
|
||||
|
||||
typedef struct {
|
||||
FuriPubSub* pubsub;
|
||||
FuriMessageQueue* queue;
|
||||
LoaderMenu_internal* loader_menu;
|
||||
LoaderAppData_internal app;
|
||||
} Loader_internal;
|
||||
|
||||
typedef struct {
|
||||
CliCallback callback;
|
||||
void* context;
|
||||
@@ -126,4 +97,4 @@ typedef struct {
|
||||
void* session;
|
||||
|
||||
size_t cursor_position;
|
||||
} Cli_internal;
|
||||
} Cli_internal;
|
||||
|
||||
Reference in New Issue
Block a user