6 Replies Latest reply on Oct 15, 2015 8:17 PM by Qwertyfly...

    ScriptUI CS6 on Mac: listbox crashes app?

    Silly-V Adobe Community Professional

      I have a very unique problem which I would have never known about because I do not have CS6 on the Mac: this very simple dialog seems to crash the entire application after it is dismissed. The only special thing about it that I can assume is the presence of a multi-column listbox with headers? It definitely works in CS5 and CC on Mac and Windows, and, as far as I am aware, on all versions on all Windows. This seemed so unlikely, and I am as happy about this being brought to my attention as I am dismayed that it's a real issue! How weird, what can be changed in this code to make it not crash?

       

       

      Crashed Thread:  0  Dispatch queue: com.apple.main-thread


      Exception Type:  EXC_BAD_ACCESS (SIGBUS)

      Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000145e3fc48

       

      #target illustrator
      function test(){
          function fillMyList(list){
              var newItem;
              if(list.items.length > 0){
                  list.removeAll();
              }
              for(var i=0; i<100; i++){
                  newItem = list.add("item");
                  newItem.text = "Hello " + (i + 1);
                  newItem.subItems[0].text = "A" + (i + 1);
                  newItem.subItems[1].text = "B" + (i + 1);
              }
      
      
          };
          function UIWindow(){
              var w = new Window("dialog", "test");
              var g0 = w.add("group");
              g0.orientation = "stack";
              var g1 = g0.add("group");
              g1.orientation = "column";
              var btn_test = g1.add("button", undefined, "Test");
                      
              var mylist = g1.add("listbox", undefined, [], {
                  numberOfColumns: 3,
                  showHeaders: true,
                  columnTitles: ["Col-1", "Col-2", "Col-3"],
                  columnWidths: [150, 100, 220]
              });
              mylist.size = [300, 200];
              
              btn_test.onClick = function(){
                  fillMyList(mylist);
              }
              
              var g_btn = g1.add("group");
              g_btn.spacing = 4;
              var btn_ok = g_btn.add("button", undefined, "Ok");
              var btn_ccl = g_btn.add("button", undefined, "Cancel");
              
              if(w.show() == 2){
                  return "Cancelled";
              } else {
                  return "Proceed";
              }
          };
      
      
          var myData = UIWindow();
          alert(myData);
      }
      test();
      
        • 1. Re: ScriptUI CS6 on Mac: listbox crashes app?
          Qwertyfly... Level 4

          I have no idea if this is correct as I don't have a mac to test it.

          my thought is that it could be due to relying on the result provided by .show().

           

          here I have replace that with .onClick and .onClose to get value and pass it to a function.

          not sure it will make a difference but worth a shot.

           

          function test(){  
              function fillMyList(list){  
                  var newItem;  
                  if(list.items.length > 0){  
                      list.removeAll();  
                  }  
                  for(var i=0; i<100; i++){  
                      newItem = list.add("item");  
                      newItem.text = "Hello " + (i + 1);  
                      newItem.subItems[0].text = "A" + (i + 1);  
                      newItem.subItems[1].text = "B" + (i + 1);  
                  }  
            
            
              };  
              function UIWindow(){  
                  var w = new Window("dialog", "test");  
                  var g0 = w.add("group");  
                  g0.orientation = "stack";  
                  var g1 = g0.add("group");  
                  g1.orientation = "column";  
                  var btn_test = g1.add("button", undefined, "Test");  
                            
                  var mylist = g1.add("listbox", undefined, [], {  
                      numberOfColumns: 3,  
                      showHeaders: true,  
                      columnTitles: ["Col-1", "Col-2", "Col-3"],  
                      columnWidths: [150, 100, 220]  
                  });  
                  mylist.size = [300, 200];  
                    
                  btn_test.onClick = function(){  
                      fillMyList(mylist);  
                  }  
                    
                  var g_btn = g1.add("group");  
                  g_btn.spacing = 4;  
                  var btn_ok = g_btn.add("button", undefined, "Ok");  
                  var btn_ccl = g_btn.add("button", undefined, "Cancel"); 
                  var result;
                  btn_ok.onClick = function(){
                      result = "Proceed";
                      w.close();
                  }
                  btn_ccl.onClick = function(){
                      result = "Cancelled";
                      w.close();
                  }
                  
                  w.onClose = function() {
                      MyFunctionThatDoesStuff(result?result:"clicked x");
                  };
                  
                  w.show();
                /*    
                  if(w.show() == 2){  
                      return "Cancelled";  
                  } else {  
                      return "Proceed";  
                  }  
                  */
              };  
              function MyFunctionThatDoesStuff(result){
                  alert(result);
               }
            
              //var myData = 
              UIWindow();  
              //alert(myData);  
          }  
          test();  
          
          • 2. Re: ScriptUI CS6 on Mac: listbox crashes app?
            Stephen_A_Marsh Adobe Community Professional

            Sadly, my CS6 Mac crashes with that script alteration…

             

            Crashed Thread:  0  Dispatch queue: com.apple.main-thread

            Exception Type:  EXC_BAD_ACCESS (SIGBUS)

            Exception Codes: KERN_PROTECTION_FAILURE at 0x00000001178d04f8

            • 4. Re: ScriptUI CS6 on Mac: listbox crashes app?
              Silly-V Adobe Community Professional

              So this is not just a regular listbox, but one with headers and multiple columns, and it's using a re-defined variable to assign properties to the list items, anything and everything could be suspect with this case.

              • 5. Re: ScriptUI CS6 on Mac: listbox crashes app?
                Silly-V Adobe Community Professional

                It appears that it's a bug which centers on multiple columns, so for Mac CS6, I think I'll make it put all the info into a single column and try to make it look as pretty as possible.

                • 6. Re: ScriptUI CS6 on Mac: listbox crashes app?
                  Qwertyfly... Level 4

                  Sorry, I've had a few issues with an engraving machine here and so have not had time to do any testing.

                  Now I have quite a backlog and can't see myself getting time to sit on the mac till next week.

                   

                  have you seen that Kahrel has updated his scriptUI document this month.

                  I've not had a chance to read all the updates but you may find some insight there.

                  ScriptUI for dummies | Peter Kahrel