Skip to content

Commit b445f6d

Browse files
authored
Use defer_low for read, write, print, load, dump (#438)
`defer_low` is needed to properly deal with dialog boxes, it turns out, so `read, write` needed changing. The others are changed to minimize surprise, i.e. `(read, print)` should still work as expected, i.e. sequentially. `load / dump` maybe don't need to change, but I can imagine `(read, dump)` calls
1 parent e71df4e commit b445f6d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

source/include/FluidMaxWrapper.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ class FluidMaxWrapper
20682068
template <size_t N>
20692069
static void deferLoad(FluidMaxWrapper* x, t_symbol*, long ac, t_atom* av)
20702070
{
2071-
defer(x, (method) doLoad<N>, nullptr, static_cast<short>(ac), av);
2071+
defer_low(x, (method) doLoad<N>, nullptr, static_cast<short>(ac), av);
20722072
}
20732073

20742074
template <size_t N>
@@ -2120,7 +2120,7 @@ class FluidMaxWrapper
21202120
template <size_t N>
21212121
static void deferDump(FluidMaxWrapper* x, t_symbol*, long ac, t_atom* av)
21222122
{
2123-
defer(x, (method) doDump<N>, nullptr, static_cast<short>(ac), av);
2123+
defer_low(x, (method) doDump<N>, nullptr, static_cast<short>(ac), av);
21242124
}
21252125

21262126
template <size_t N>
@@ -2207,7 +2207,7 @@ class FluidMaxWrapper
22072207
template <size_t N>
22082208
static void deferPrint(FluidMaxWrapper* x, t_symbol*, long, t_atom*)
22092209
{
2210-
defer(x, (method) doPrint<N>, nullptr, 0, nullptr);
2210+
defer_low(x, (method) doPrint<N>, nullptr, 0, nullptr);
22112211
}
22122212

22132213
template <size_t N>
@@ -2225,7 +2225,8 @@ class FluidMaxWrapper
22252225
template <size_t N>
22262226
static void deferRead(FluidMaxWrapper* x, t_symbol* s)
22272227
{
2228-
defer(x, (method) &doRead<N>, s, 0, nullptr);
2228+
// defer_low because we have a dialog box situation
2229+
defer_low(x, (method) &doRead<N>, s, 0, nullptr);
22292230
}
22302231

22312232
template <size_t N>
@@ -2245,9 +2246,12 @@ class FluidMaxWrapper
22452246
char fullpath[MAX_PATH_CHARS];
22462247

22472248
if (s == gensym(""))
2248-
{
2249-
if (open_dialog(filename, &path, &outtype, &filetype, 1))
2249+
{
2250+
short openResult = open_dialog(filename, &path, &outtype, &filetype, 1);
2251+
if (openResult != 0)
2252+
{
22502253
return; // non-zero -> cancel
2254+
}
22512255
}
22522256
else
22532257
{
@@ -2272,7 +2276,8 @@ class FluidMaxWrapper
22722276
template <size_t N>
22732277
static void deferWrite(FluidMaxWrapper* x, t_symbol* s)
22742278
{
2275-
defer(x, (method) &doWrite<N>, s, 0, nullptr);
2279+
// defer_low because we have a dialog box situation
2280+
defer_low(x, (method) &doWrite<N>, s, 0, nullptr);
22762281
}
22772282

22782283
template <size_t N>

0 commit comments

Comments
 (0)