Add_group() + outliner = bugsplat
-
Hi !
In my Layers Panel plugin, I use a modification of TIG's layer.delete() snippet.
I use it as a method for my namespace module, and wrap everything in start_operation/commit_operation. Everything seemed to work fine since I added this, but today I noticed that it creates a bugsplat when outliner is opened.<span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">deleteLayer</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">layer</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> delete_geometry</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">false</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">start_operation</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"jbb is an awesome guy !"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> group</span><span class="syntaxkeyword">=@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_group</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">layer</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">nil<br /> gents</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br /> temp</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">gents</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_group</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> </span><span class="syntaxcomment">### <- It bugsplats here<br /><br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">#some code...<br /><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">commit_operation<br />end</span><span class="syntaxcomment">#def </span><span class="syntaxdefault"></span>
The thing is, it doesn't bugsplat when not wrapped up in start/commit_operation...
Has anybody experienced something like that ? Any hint why it does that ?
-
What would be best ? Leaving it like that with the risk that people will try deleting/purging layers with Outline opened, and inevitably get bugsplats. Or start the operation after
temp=gents.add_group()
, so there would be 2 more transactions in the undo stack for everyone ? -
Try this just to be sure:
def self.deleteLayer(layer, delete_geometry=false) # disable_ui = true @model.start_operation( "jbb Op test", disable_ui ) # SU ver 7+ # group=@model.entities.add_group() # cp1 = group.entities.add_cpoint(ORIGIN) # group.layer=nil gents=group.entities temp=gents.add_group() ### <- It bugsplats here # cp2 = temp.entities.add_cpoint(ORIGIN) # # some code... # temp.entities.erase_entities(cp2) group.entities.erase_entities(cp1) # @model.commit_operation end#def
-
@jiminy-billy-bob said:
What would be best ? Leaving it like that with the risk that people will try deleting/purging layers with Outline opened, ...
Best to always use the
**disable_ui**
arg set totrue
during the operation. -
**disable_ui**
works like a charm !Thanks a lot Dan !
-
I'm not able to reproduce this.
Can you provide a full working example, so I can hit run and it calls the method with the exact arguments you do?
Also, does it crash only under Windows? Or also OSX?
Does it crash only on SU2013, or also older versions?Even though you found a workaround I would like to find the cause of this crash.
-
Install my plugin, and try to purge/delete layers from the dialog while having outliner opened. You'll get a bugsplat.
Tested on win7, SU8/13. -
I can reproduce this.
-
Ok, so no need to PM you the old version ?
If you're trying to reproduce it within the plugin, change line 100 to@model.start_operation("Delete layer", false)
, and line 465 to@model.start_operation("Purge unused layers", false)
-
@tt_su said:
(Also, what did you do to avoid the crash?)
What Dan told me above : Disable UI during the operation.
-
Yea, I realized that after posting. I've logged a bug internally.
-
Great, thanks !
Advertisement