Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
bugger
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more