mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 20:58:36 -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 "cli_control.h"
|
||||||
#include "text_input.h"
|
#include "text_input.h"
|
||||||
#include "console_output.h"
|
#include "console_output.h"
|
||||||
|
#include <loader/loader_i.h>
|
||||||
|
|
||||||
static bool cligui_custom_event_cb(void* context, uint32_t event) {
|
static bool cligui_custom_event_cb(void* context, uint32_t event) {
|
||||||
UNUSED(event);
|
UNUSED(event);
|
||||||
@@ -69,9 +70,8 @@ int32_t cligui_main(void* p) {
|
|||||||
// Unlock loader-lock and save app thread
|
// Unlock loader-lock and save app thread
|
||||||
FuriThread* temp_save_appthr;
|
FuriThread* temp_save_appthr;
|
||||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||||
Loader_internal* loader_i = (Loader_internal*)loader;
|
temp_save_appthr = loader->app.thread;
|
||||||
temp_save_appthr = loader_i->app.thread;
|
loader->app.thread = NULL;
|
||||||
loader_unlock(loader);
|
|
||||||
furi_record_close(RECORD_LOADER);
|
furi_record_close(RECORD_LOADER);
|
||||||
|
|
||||||
CliguiApp* cligui = malloc(sizeof(CliguiApp));
|
CliguiApp* cligui = malloc(sizeof(CliguiApp));
|
||||||
@@ -138,11 +138,9 @@ int32_t cligui_main(void* p) {
|
|||||||
free(cligui->data);
|
free(cligui->data);
|
||||||
free(cligui);
|
free(cligui);
|
||||||
|
|
||||||
// Don't touch system loader!!! We restoring previous app thread here, we love kostily and velosipedy, bydlo kod forever!
|
// We restoring previous app thread here, we love kostily and velosipedy, bydlo kod forever!
|
||||||
|
loader = furi_record_open(RECORD_LOADER);
|
||||||
Loader* loader1 = furi_record_open(RECORD_LOADER);
|
loader->app.thread = temp_save_appthr;
|
||||||
Loader_internal* loader_ii = (Loader_internal*)loader1;
|
|
||||||
loader_ii->app.thread = temp_save_appthr;
|
|
||||||
furi_record_close(RECORD_LOADER);
|
furi_record_close(RECORD_LOADER);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
29
applications/external/cli_bridge/internal_defs.h
vendored
29
applications/external/cli_bridge/internal_defs.h
vendored
@@ -71,35 +71,6 @@ typedef struct {
|
|||||||
void* input_callback_context;
|
void* input_callback_context;
|
||||||
} ViewPort_internal;
|
} 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 {
|
typedef struct {
|
||||||
CliCallback callback;
|
CliCallback callback;
|
||||||
void* context;
|
void* context;
|
||||||
|
|||||||
Reference in New Issue
Block a user