[haiku-commits] r42653 - haiku/trunk/src/apps/debugger/user_interface/gui/teams_window

  • From: philippe.houdoin@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 21 Aug 2011 11:36:19 +0200 (CEST)

Author: phoudoin
Date: 2011-08-21 11:36:19 +0200 (Sun, 21 Aug 2011)
New Revision: 42653
Changeset: https://dev.haiku-os.org/changeset/42653

Modified:
   
haiku/trunk/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp
Log:
Now always retrieve the team icon from the first B_APP_IMAGE image entry_ref.
Using team_info.args as before was not safe: when truncated, the 
entry_ref could be an intermediate folder, which display a folder 
icon as team's icon!


Modified: 
haiku/trunk/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp
===================================================================
--- 
haiku/trunk/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp 
    2011-08-21 02:57:07 UTC (rev 42652)
+++ 
haiku/trunk/src/apps/debugger/user_interface/gui/teams_window/TeamsListView.cpp 
    2011-08-21 09:36:19 UTC (rev 42653)
@@ -229,8 +229,25 @@
                        get_ref_for_path(kernelPath.Path(), &appInfo.ref);
                }
        } else {
-               BEntry entry(teamInfo.args, true);
-               entry.GetRef(&appInfo.ref);
+               // Not an application known to be_roster
+               
+               // The teamInfo.args string is not safe and could be truncated. 
+               // This could leads to show an intermediate folder icon!
+               //
+               // Let's retrieve instead the entry_ref from the first team's 
image of 
+               // type B_APP_IMAGE
+               int32 cookie = 0;
+               image_info imageInfo;
+               while (get_next_image_info(teamInfo.team, &cookie, &imageInfo) 
== B_OK) {
+                       if (imageInfo.type == B_APP_IMAGE) {
+                               BPath imagePath(imageInfo.name);
+                               appInfo.ref.device              = 
imageInfo.device;
+                               appInfo.ref.directory   = imageInfo.node;
+                               appInfo.ref.set_name(imagePath.Leaf());
+                               break;
+                       }
+               }
+               
        }
 
        BBitmap* icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 
1), B_RGBA32);


Other related posts: