Browse code

Fix bug because of stray CloswWindow() call

Dario Rodriguez authored on 11/03/2025 19:34:03
Showing 1 changed files
... ...
@@ -303,7 +303,6 @@ fprintf(stderr,"SELECTED: \"%s\"->\"%s\"\n",sel_menu,sel_submenu);
303 303
 #endif
304 304
                 EndDrawing();
305 305
         }
306
-        CloseWindow();
307 306
         im_free(im),im=NULL;
308 307
         return(0);
309 308
 }
... ...
@@ -353,7 +352,7 @@ im_free(im_t *im)
353 352
                 im_font_free(im->fontbig),im->fontbig=NULL;
354 353
         if(im->fonthuge!=NULL)
355 354
                 im_font_free(im->fonthuge),im->fonthuge=NULL;
356
-#if 0 /* not working as intended */
355
+#if 1 /* not working as intended */
357 356
         if(im->windowinit)
358 357
                 CloseWindow(),im->windowinit=0;
359 358
 #endif
... ...
@@ -656,8 +655,6 @@ im_body_free(body_t *body)
656 655
         dirdata_t *dirdata;
657 656
         if(body==NULL)
658 657
                 return; /* nothing to do */
659
-        if(body->rootdir!=NULL)
660
-                free(body->rootdir),body->rootdir=NULL;
661 658
         if(body->dirdata!=NULL) {
662 659
                 for(i=0;i<body->sizedirdata;i++) {
663 660
                         if((dirdata=body->dirdata[i])==NULL)
... ...
@@ -675,6 +672,8 @@ im_body_free(body_t *body)
675 672
                 body->has_texture=0;
676 673
                 body->has_failedload=0;
677 674
         }
675
+        if(body->rootdir!=NULL)
676
+                free(body->rootdir),body->rootdir=NULL;
678 677
         free(body),body=NULL;
679 678
         return;
680 679
 }
... ...
@@ -923,9 +922,8 @@ DrawRectangle(UNROLLXYWH(body->backxywh),((Color){ 0,255,0,255 })); /* hit zone
923 922
                                 }
924 923
                                 /* show image */
925 924
                                 has_imagedrawn=0;
926
-#if 1
927 925
                                 if(is_imagefilename(elem->name+1)) {
928
-                                        if(thumb->has_texture==0) {
926
+                                        if(thumb->has_texture==0 && thumb->has_failedload==0) {
929 927
                                                 Image im;
930 928
                                                 char fullpath[2048];
931 929
                                                 snprintf(fullpath,sizeof(fullpath),"%s/%s/%s",body->rootdir,dirdata->dirname,elem->name+1);
... ...
@@ -955,6 +953,8 @@ fprintf(stderr,"elem:\"%s\" sidelen:%i old:%ix%i new:%ix%i\n",elem->name+1,sidel
955 953
                                                         UnloadImage(im);
956 954
                                                         UnloadImage(im2);
957 955
                                                         thumb->has_texture=1;
956
+                                                } else {
957
+                                                        thumb->has_failedload=1;
958 958
                                                 }
959 959
                                         }
960 960
                                         if(thumb->has_texture!=0) {
... ...
@@ -1014,7 +1014,6 @@ fprintf(stderr,"elem:\"%s\" sidelen:%i old:%ix%i new:%ix%i\n",elem->name+1,sidel
1014 1014
                                                 }
1015 1015
                                         }
1016 1016
                                 }
1017
-#endif
1018 1017
                                 if(has_imagedrawn==0) {
1019 1018
                                         char *ptr;
1020 1019
                                         char shortname[1024];