I've wedded FLTK 1.3 to the Photoshop plug-in (CS5 SDK) and have been
extremely happy with write-once, use-many. Coding on the Mac has been
straightforward and I've just ported my UI to the PC. (Win7).
Here's the problem -- the plug-in (DLL) will run once. (64-bit or 32-bit
doesn't matter) The second time I invoke it, the UI fails to come up and I'm
stuck in some kind of infinite loop waiting for events that I cannot get
because there is no window.
I tried replacing Fl::run() with this construct:
Fl::flush(); //allow dialog to appear prior to event loop
while(window->visible())
Fl::wait();
Fl::flush();
It hasn't appeared to help. :(
It appears that the w->show() function on my window (and it can be as primitive
as an empty Fl_Window) simply fails. Fl_Double_Window fails, too.
As you can see above, I've added an Fl::flush() call after the w->show(), and
it still fails most of the time. Yet the w->shown() flag is TRUE at that
point. I can't tell if this is because of a w->hide() that puts the window
down from the previous execution or what.
Other tidbits -- Adobe loads the DLL and then leaves it open, so it isn't clear
that my environment is getting reinitialized. I've taken care to reinitialize
all of MY static initialization variables, but that hasn't made a difference.
Adobe's MessageBox function still works -- I can put up one of their windows
even when the w->show() function fails (and that is how I figured out that it
hadn't crashed at this point and that it didn't make it past the while-loop or
Fl:run().)
Is there some kind of cleanup call I should make on the way out from the first
time through?
I'm inside of a DLL at this point and have been called by someone else's app
(Photoshop), so we can't leave with exit();
Please help.
(originally posted under fltk.bugs -- don't know if that is a better place than
here to post)
------------
UPDATE 8/29/12 3pm
Adobe's documentation suggests that after CS4 they do not unload DLLs/plugins
between calls for speed. This means that, as I surmised, any FLTK
initialization only takes place once. I'm about to dive into using fltkdll.dll
instead so that I can _explicitly_ reinitialize fltk between sessions. Since
this code always works like a champ the first time, I think I can make each
time be THE. FIRST. TIME.
But if anyone has a suggestion, I'm all ears.
Thanks.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk