Author: AlbrechtS
Date: 2009-05-03 10:43:19 -0700 (Sun, 03 May 2009)
New Revision: 6786
Log:
Avoiding crashes for recursive common dialogs (this does not fix the issue
at hand yet) (STR #2150).

Fix for multiple popups, when dragging and calling fl_alert() and friends
from the callback (STR #2159)


Modified:
   branches/branch-1.1/CHANGES
   branches/branch-1.1/src/fl_ask.cxx

Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-05-01 18:46:22 UTC (rev 6785)
+++ branches/branch-1.1/CHANGES 2009-05-03 17:43:19 UTC (rev 6786)
@@ -1,5 +1,9 @@
 CHANGES IN FLTK 1.1.10
 
+       - Fix for multiple popups, when dragging and calling fl_alert()
+         and friends from the callback (STR #2159)
+       - Avoiding crashes for recursive common dialogs (this does not 
+         fix the issue at hand yet) (STR 2150)
        - Fluid printing used wrong colors under Windows (STR #2195)
        - Fixed bad system menu hadling in OS X (STR #2153)
        - Fixed File Input mouse pointer dragging (STR #2181)

Modified: branches/branch-1.1/src/fl_ask.cxx
===================================================================
--- branches/branch-1.1/src/fl_ask.cxx  2009-05-01 18:46:22 UTC (rev 6785)
+++ branches/branch-1.1/src/fl_ask.cxx  2009-05-03 17:43:19 UTC (rev 6786)
@@ -56,6 +56,8 @@
 Fl_Font fl_message_font_ = FL_HELVETICA;
 uchar fl_message_size_ = 14;
 
+static char avoidRecursion = 0;
+
 static Fl_Window *makeform() {
  if (message_form) {
    message_form->size(410,103);
@@ -176,6 +178,10 @@
   const char *b1,
   const char *b2)
 {
+  Fl::pushed(0); // stop dragging (STR #2159)
+
+  avoidRecursion = 1;
+
   makeform();
   char buffer[1024];
   if (!strcmp(fmt,"%s")) {
@@ -212,7 +218,7 @@
   Fl_Window* g = Fl::grab();
   if (g) // do an alternative grab to avoid floating menus, if possible
     Fl::grab(message_form);
-  int r;
+  int r = 0;
   for (;;) {
     Fl_Widget *o = Fl::readqueue();
     if (!o) Fl::wait();
@@ -225,6 +231,8 @@
     Fl::grab(g);
   message_form->hide();
   icon->label(prev_icon_label);
+
+  avoidRecursion = 0;
   return r;
 }
 
@@ -283,6 +291,9 @@
 }
 
 void fl_message(const char *fmt, ...) {
+
+  if (avoidRecursion) return;
+
   va_list ap;
 
   fl_beep(FL_BEEP_MESSAGE);
@@ -295,6 +306,9 @@
 }
 
 void fl_alert(const char *fmt, ...) {
+
+  if (avoidRecursion) return;
+
   va_list ap;
 
   fl_beep(FL_BEEP_ERROR);
@@ -307,6 +321,9 @@
 }
 
 int fl_ask(const char *fmt, ...) {
+
+  if (avoidRecursion) return 0;
+
   va_list ap;
 
   fl_beep(FL_BEEP_QUESTION);
@@ -319,6 +336,9 @@
 }
 
 int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){
+
+  if (avoidRecursion) return 0;
+
   va_list ap;
 
   fl_beep(FL_BEEP_QUESTION);
@@ -347,6 +367,9 @@
 }
 
 const char* fl_input(const char *fmt, const char *defstr, ...) {
+
+  if (avoidRecursion) return 0;
+
   fl_beep(FL_BEEP_QUESTION);
 
   va_list ap;
@@ -357,6 +380,9 @@
 }
 
 const char *fl_password(const char *fmt, const char *defstr, ...) {
+
+  if (avoidRecursion) return 0;
+
   fl_beep(FL_BEEP_PASSWORD);
 
   va_list ap;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to