File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
applications/external/flipper_i2ctools Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11#include "i2ctools_i.h"
22
33void i2ctools_draw_callback (Canvas * canvas , void * ctx ) {
4+ furi_assert (ctx );
45 i2cTools * i2ctools = ctx ;
5- if (furi_mutex_acquire (i2ctools -> mutex , 200 ) != FuriStatusOk ) {
6- return ;
7- }
6+ furi_mutex_acquire (i2ctools -> mutex , FuriWaitForever );
87
98 switch (i2ctools -> main_view -> current_view ) {
109 case MAIN_VIEW :
@@ -46,6 +45,11 @@ int32_t i2ctools_app(void* p) {
4645 // Alloc i2ctools
4746 i2cTools * i2ctools = malloc (sizeof (i2cTools ));
4847 i2ctools -> mutex = furi_mutex_alloc (FuriMutexTypeNormal );
48+ if (!i2ctools -> mutex ) {
49+ FURI_LOG_E (APP_NAME , "cannot create mutex\r\n" );
50+ free (i2ctools );
51+ return -1 ;
52+ }
4953
5054 // Alloc viewport
5155 i2ctools -> view_port = view_port_alloc ();
@@ -220,6 +224,7 @@ int32_t i2ctools_app(void* p) {
220224 i2c_scanner_free (i2ctools -> scanner );
221225 i2c_sender_free (i2ctools -> sender );
222226 i2c_main_view_free (i2ctools -> main_view );
227+ furi_mutex_free (i2ctools -> mutex );
223228 free (i2ctools );
224229 furi_record_close (RECORD_GUI );
225230 return 0 ;
You can’t perform that action at this time.
0 commit comments