]> code.delx.au - refind/commitdiff
Stop crashing on launching a second program. (Tentative fix.)
authorsrs5694 <srs5694@users.sourceforge.net>
Mon, 26 Mar 2012 06:24:52 +0000 (02:24 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Mon, 26 Mar 2012 06:24:52 +0000 (02:24 -0400)
NEWS.txt
docs/refind/todo.html
refind/lib.c
refind/main.c

index 0566af17181c8da1bb78e91f4eb7a459f027b289..946ec9832257cbd1bf810bc04de11ed5c8679103 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,14 @@
 0.2.3 (?/??/2012):
 ------------------
 
+- Fixed (maybe) a bug that caused hangs when launching a second program
+  after returning from a first. There are some weird system-to-system
+  differences, though, and this fix causes (apparently harmless) error
+  messages about "(re)opening our installation volume" on at least one
+  system (a 32-bit Mac Mini). I'm committing this change because, imperfect
+  though it is, it's preferable to the earlier version, at least on my
+  small sample of computers.
+
 - Because of news that the Linux kernel developers are planning to use the
   filename linux.conf to hold Linux kernel configuration data for EFI
   booting, I'm transitioning rEFInd away from that name and to
index 500643deeb5c8e9db0b796598a9d6e3315622a91..234a30fed85bab5f71593f8d0ba5c9b87b826182 100644 (file)
@@ -117,8 +117,6 @@ program. I'm not sure what you'd use in Windows to create ICNS files.</li>
 
 <li>The code could be more flexible in its handling of the sizes of various graphical elements, and particularly drawn text. Prior to version 0.2.2, submenu text was invisible on UEFI-based PCs with 800x600 and smaller displays because of an inability to properly crop the graphics fields that hold the text. With version 0.2.2, I've put a band-aid on this problem by reducing the field size so that it now works on 800x600 displays, but smaller displays still suffer from this problem. This is just an example of the inflexibility of certain layout issues within rEFInd.</li>
 
-<li>On some (but not all) EFIs, launching a program from rEFInd, exiting that program, and then launching another program from rEFInd results in a system hang. This should obviously be fixed; it makes it hard to use a shell and then launch an OS without rebooting, or to exit from a loader that permits exiting.</li>
-
 <li>I want to be able to specify the volume on which a boot loader resides in <tt>refind.conf</tt>. (As it is, manually-defined options can only launch boot loader files on the same volume as rEFInd.)</li>
 
 <li>It would be useful to be able to specify paths to boot loaders and/or initial RAM disks relative to the rEFInd directory (or the boot loader's directory, in the case of initrds).</li>
index a4618dc9c1f663ca2e3b520eb86f8622b61980e5..3feacbe93e44c90de1c9d091d50114a62d98ffb2 100644 (file)
@@ -103,15 +103,15 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
 VOID UninitRefitLib(VOID)
 {
     UninitVolumes();
-    
+
     if (SelfDir != NULL) {
         refit_call1_wrapper(SelfDir->Close, SelfDir);
         SelfDir = NULL;
     }
-    
+
     if (SelfRootDir != NULL) {
-        refit_call1_wrapper(SelfRootDir->Close, SelfRootDir);
-        SelfRootDir = NULL;
+       refit_call1_wrapper(SelfRootDir->Close, SelfRootDir);
+       SelfRootDir = NULL;
     }
 }
 
@@ -119,10 +119,18 @@ VOID UninitRefitLib(VOID)
 EFI_STATUS ReinitRefitLib(VOID)
 {
     ReinitVolumes();
-    
-    if (SelfVolume != NULL && SelfVolume->RootDir != NULL)
-        SelfRootDir = SelfVolume->RootDir;
-    
+
+    // Below two lines were in rEFIt, but seem to cause problems on
+    // most systems. OTOH, my Mac Mini produces (apparently harmless)
+    // errors about "(re)opening our installation volume" (see the
+    // next function) when returning from programs when these two lines
+    // are removed. On the gripping hand, the Mac SOMETIMES crashes
+    // when launching a second program even with these lines removed.
+    // TODO: Figure out cause of above weirdness and fix it more
+    // reliably!
+    /* if (SelfVolume != NULL && SelfVolume->RootDir != NULL)
+       SelfRootDir = SelfVolume->RootDir; */
+
     return FinishInitRefitLib();
 }
 
index 2ff9a3bd9cb3a66ed4a8d9a28ee5d201b64f5da1..8e63ad3d7da2106f5201cb954519145e5805089f 100644 (file)
@@ -74,7 +74,7 @@ static VOID AboutrEFInd(VOID)
 {
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.2.1");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.2.2");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
@@ -82,7 +82,7 @@ static VOID AboutrEFInd(VOID)
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Running on:");
         AddMenuInfoLine(&AboutMenu, PoolPrint(L" EFI Revision %d.%02d",
-            ST->Hdr.Revision >> 16, ST->Hdr.Revision & ((1 << 16) - 1)));
+                        ST->Hdr.Revision >> 16, ST->Hdr.Revision & ((1 << 16) - 1)));
 #if defined(EFI32)
         AddMenuInfoLine(&AboutMenu, L" Platform: x86 (32 bit)");
 #elif defined(EFIX64)
@@ -134,13 +134,13 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
 
     // set load options
     if (LoadOptions != NULL) {
-      ReturnStatus = Status = refit_call3_wrapper(BS->HandleProtocol, ChildImageHandle, &LoadedImageProtocol, (VOID **) &ChildLoadedImage);
+        ReturnStatus = Status = refit_call3_wrapper(BS->HandleProtocol, ChildImageHandle, &LoadedImageProtocol, (VOID **) &ChildLoadedImage);
         if (CheckError(Status, L"while getting a LoadedImageProtocol handle")) {
             if (ErrorInStep != NULL)
                 *ErrorInStep = 2;
             goto bailout_unload;
         }
-        
+
         if (LoadOptionsPrefix != NULL) {
             FullLoadOptions = PoolPrint(L"%s %s ", LoadOptionsPrefix, LoadOptions);
             // NOTE: That last space is also added by the EFI shell and seems to be significant
@@ -196,9 +196,11 @@ static EFI_STATUS StartEFIImage(IN EFI_DEVICE_PATH *DevicePath,
 
 static VOID StartLoader(IN LOADER_ENTRY *Entry)
 {
+    UINTN ErrorInStep = 0;
+
     BeginExternalScreen(Entry->UseGraphicsMode, L"Booting OS");
     StartEFIImage(Entry->DevicePath, Entry->LoadOptions,
-                  Basename(Entry->LoaderPath), Basename(Entry->LoaderPath), NULL);
+                  Basename(Entry->LoaderPath), Basename(Entry->LoaderPath), &ErrorInStep);
     FinishExternalScreen();
 }