saveas_dialog crashes max

    Feb 11 2014 | 2:53 pm
    hi there,
    what i eventually want to come up with, is a dialog that lets the user select a folder (like [savedialog fold] in max).
    so i'm experimenting with saveas_dialog() and saveasdialog_extended() - both seem to have severe problems (or maybe it's just me?) - Max 6.1.6 & SDK 6.1.4 on mac os 10.6
    in the stripped down example below both calls to saveas_dialog or saveasdialog_extended crash badly - even without the time for a crash report or anything - where as the call to open_dialog() works fine.
    but unfortunately didn't lead anywhere.
    does anybody see what's wrong?
    #include "ext.h"
    #include "ext_obex.h"
    #include "ext_common.h"
    static t_class *myObj_class;
    typedef struct {
    	t_object b_ob;
    } t_myObj;
    void *myObj_new( t_symbol *s, long argc, t_atom *argv);
    void myObj_saveme(t_myObj *x);
    void myObj_dosave(t_myObj *x);
    int C74_EXPORT main(void) {
    	t_class *c = class_new("testSaveas", (method)myObj_new, 0, (short)sizeof(t_myObj), 0L, A_GIMME, 0L);	
    	class_addmethod(c, (method)myObj_saveme, "bang", 0);
    	class_register(CLASS_BOX, c);
    	myObj_class = c;
    	return 0;
    void myObj_saveme(t_myObj *x) {
    	defer_low(x, (method)myObj_dosave, 0, 0, 0L);
    void myObj_dosave(t_myObj *x) {
    	short		pathID;
    	char		filename[MAX_FILENAME_CHARS];	
    	t_fourcc	type;
    	// open_dialog(filename, &pathID, &type, 0L, 0);		// works fine
    	saveas_dialog(filename, &pathID, NULL);				//

    • Feb 11 2014 | 9:53 pm
      Perhaps, you should use a "t_fourcc" instead of 0L for the filetypelist ?
    • Feb 12 2014 | 7:57 am
      Perhaps, you should use a “t_fourcc” instead of 0L for the filetypelist ?
      saveas_dialog() uses no typelist.
      and for saveasdialog_extended() it doesn't prevent the crash either.
    • Feb 13 2014 | 6:54 pm
      Hi Volker,
      on my platform (MacOS 10.9 running Max/MSP 6.1.6 64-bit) this seems to work without crashing:
      void myObj_dosave(t_myObj *x)
          char        filename[MAX_FILENAME_CHARS];
          short       pathID;
          t_fourcc    type;
          t_fourcc    typelist[2] = { 'JSON', 'TEXT' };
          short       typecount = 2;
          strcpy(filename, "untitled");
          if (saveasdialog_extended(filename, &pathID, &type, typelist, typecount)) {
          post("filename: %s -- pathID: %d", filename, pathID);
          // keep going...
      Let me know if it works for you too...
      - Luigi
    • Feb 13 2014 | 8:44 pm
      hi luigi
      thanks for looking into this! and yes, your example works here, too.
      i started poking round a little and the types and typelist stuff can all be zero.
      but strcpy seems to make the difference (which makes sense, as this defines the default filename which is presented in the dialog).
      actually this is what i want to get rid off in the end, to end up with a dialog, where the user can select a folder (not a file). somebody knows, how to get that?
      all the best,
    • Jun 08 2015 | 11:09 am
      addressing t_fourcc with 'fold' for the open_dialog does nothing :/
      Does someone has any clue how to force open_dialog to expect folder location ?