On 19/06/2014 at 18:42, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R14 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi Folks,
I seem to have run into a little snag with one of my commands' dialog.Open() calls. Here's the scenario:
I've got two dialogs, a small one, and a larger parent one. Both dialogs are open at the same time. I now want to close the smaller dialog, and reopen it using a different dialog type flag. I do this by having a command in the smaller dialogs menu, which sends a call to a function in the larger dialog to run. Inside this function, I call a separate thread, which is used to close the smaller dialog down, wait for it to be null and void, then send a CoreMessage() to the parent dialog to reopen the smaller dialog, but this time using a different dialog-type flag. This all works fine, except for when a different flag is used in the dlg.Open() call (e.g. going from an open DLG_TYPE_ASYNC dialog, closing it, and reopening it with DLG_TYPE_ASYNC_POPUPEDIT).
All the dialog flag types and size settings etc are set inside the command plugin that opens the dialog.
Also note that dialog type and sizes need to be taken into account when changing the smaller one over.
So my query is, what might be causing this crash (given the reopening is waiting for the previous small dialog pointer to become null and void before opening a new one) and how can I circumvent this? Or is there an easier way to change a dialog type (maybe through RestoreLayout()??), if so, how can this be done?
P.s. just a note - I'm still working on the iCustomGui stuff in a previous topic (which is still not working!). Just letting others know it hasn't been swept under the carpet!

On 21/06/2014 at 00:56, xxxxxxxx wrote:

Just as a further note to the above, it seems to crash when the command plugin's RestoreLayout() is called. Returning TRUE or FALSE makes no difference - it crashes on both.
EDIT: Oh - and the error I get is an ACCESS_VIOLATION.

On 21/06/2014 at 19:10, xxxxxxxx wrote:

OK, I think I've managed to sort this one out! I was using a dialog object in the CommandData plugin, instead of a referenced dialog.

On 23/06/2014 at 06:16, xxxxxxxx wrote:

Nope, it looks like I've embarrassed myself even further! Turns out is was a nasty array container being accessed with incorrect index values! Meh.
Don't normally do the icon thing... but Embarrassed !
(I'm just waiting on that iCustomGui stuff to be the next little indiscretion..!)