[Closed] Strange crash with mixed dotNet and Max button
So I have a typical create dialog with a containerControl and a treeview in the container. I also have two Max Script buttons, one has an event handler that is just printing a local variable at the moment and has nothing to do with the treeview at all. How ever once I have pressed the button and I try and click on the treeview it locks up Max and crashes it. Not just the script but Max it self.
Any one ever seen anything like that? Still testing to see what I can find but it has been elusive so far.
Found it, no wonder I had a hard time. I’m getting the createDialog to be modal and that is the cause of it. WTF!
rollout testR "Test"
(
local someString=""
button testBt "Test"
dotNetControl cc "containerControl"
fn initTv=
(
tv=dotNetObject "treeView"
cc.controls.add tv
tv.dock=tv.dock.fill
)
on testBt pressed do
(
print someString
)
on testR open do
(
initTv()
)
)
createDialog testR width:400 height:400 modal:true
Yes, seems to be a very shy bug
I only could repro it the FIRST run. After that all subsequent runs do not repro the bug. Everything is working as expected and no deadlock occures.
So it’s propably some .NET initialization problem ?
I bet after a system reboot, i would again be able to repro
I can reproduce it every time. It also has nothing to do with treeview per se, you can replace it with ‘Button’ for example and still get the same result.
Just when you think you’ve seen every 3dsmax bug…
could you post a code that crashes your max for sure, please? i can’t reproduce the issue
I don’t get any problems on 2013, works fine, either modal or not. :shrug:
EDIT: i see it now. my bad. What a crock of sh*t!
yes. i see it now. i use slightly modified dotnet plugin in max 2010… it doesn’t crash. max 2014 constantly crashes with your sample…
it’s bad. because it’s a very likely scenario. it would be interesting to find a solution.
i’ve localized the problem. the issue is related to stealing a focus from mxs control by .net control.
check the sample where i move the focus from “GOOD Button” to the Container and the window works.
try(destroydialog crashtest) catch()
rollout crashtest "Crash Test" width:200
(
button mxs_bt "GOOD Button" width:100
button bad_bt "BAD Button" width:100
dotNetControl cc "ContainerControl" height:24
fn init =
(
bt = dotnetobject "Button"
bt.Backcolor = bt.Backcolor.Transparent
bt.text = ".NET Button"
controlops.setselectable bt off
bt.Dock = bt.Dock.Fill
cc.controls.add bt
)
on mxs_bt pressed do
(
setfocus cc
)
on crashtest open do
(
init()
)
)
createDialog crashtest modal:on
another localization… the dotnetcontrol causes the problem. when i directly parent a dotnet form control to a mxs rollout everything works well.
i kinda know the answer…
“we are too busy because of making the new ORANGE interface, and there is no time for us to fix any bug that was made more than ten years ago. sorry, but we can not be responsible for every sh#t we wrote… thanks again. good luck and be happy! :)”