This is an automatically generated mail from the syncmail system.  Do not reply 
directly to this email.  Further discussion should take place on the hackers 
list: perl-win32-gui-hack...@lists.sourceforge.net

Update of /cvsroot/perl-win32-gui/Win32-GUI
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27411

Modified Files:
        CHANGELOG GUI_Helpers.cpp 
Log Message:
Bug fix tracker#1941264

Index: GUI_Helpers.cpp
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/GUI_Helpers.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** GUI_Helpers.cpp     8 Feb 2008 16:42:11 -0000       1.25
--- GUI_Helpers.cpp     20 Feb 2010 12:22:27 -0000      1.26
***************
*** 754,806 ****
      if(ValidUserData(perlud)) {
        PERLUD_FETCH;       /* fetch context */
  
!       arrayref = av_fetch(perlud->avHooks, WM_TRACKPOPUP_MSGHOOK, 0);
!       if(arrayref != NULL) {
!         array = (AV*) SvRV(*arrayref);
!         SvREFCNT_inc((SV*) array);
!         for(i = 0; i <= (int) av_len(array); i++) {
!           arrayval = av_fetch(array,(I32) i,0);
  
!           if(arrayval != NULL) {
!             perlsub = *arrayval;
!             SvREFCNT_inc(perlsub);
!             dSP;
!             ENTER;
!             SAVETMPS;
!             PUSHMARK(SP);
!               XPUSHs(perlud->svSelf);
!               XPUSHs(sv_2mortal(newSViv(pmsg->message)));
!               XPUSHs(sv_2mortal(newSViv(pmsg->wParam)));
!               XPUSHs(sv_2mortal(newSViv(pmsg->lParam)));
!             PUTBACK;
  
!             count = call_sv(perlsub, G_ARRAY|G_EVAL);
!             SPAGAIN;
  
!             if(SvTRUE(ERRSV)) {
!               ProcessEventError(NOTXSCALL 
"TrackPopupMenu(WindowsHookMsgProc)", &PerlResult);
!             } else {
!               if(count > 0) { PerlResult = POPi; }
              }
- 
-             PUTBACK;
-             FREETMPS;
-             LEAVE;
-             SvREFCNT_dec(perlsub);
            }
!         }
!         SvREFCNT_dec((SV*) array);
  
!         // PerlResult = 0: do not pass event to rest of chain or target 
windows procedure
!         // PerlResult = -1: as 0, and terminate application
!         // PerlResult = anything else, pass event on
!         if(PerlResult == 0) {
!           return 1;  // stops message being passed along hook chain and to 
target windows procedure
!         } else if (PerlResult == -1) {
!           //send a WM_CANCELMODE to get menu to close
!           SendMessage(pmsg->hwnd, WM_CANCELMODE, 0, 0);
!           //post a message to get the main loop to exit
!           PostMessage(pmsg->hwnd, WM_EXITLOOP, (WPARAM) -1, 0);
!           return 1;  // stops message being passed along hook chain and to 
target windows procedure
          }
        }
--- 754,811 ----
      if(ValidUserData(perlud)) {
        PERLUD_FETCH;       /* fetch context */
+       
+       //Tracker 1941264: Check if perlud->avHooks contains NULL. This was 
causing
+       //a crash although it should not be possible that this is zero. It's 
likely
+       //a bug elsewhere...No harm in the null pointer check though.
+       if (perlud->avHooks != NULL) {
+         arrayref = av_fetch(perlud->avHooks, WM_TRACKPOPUP_MSGHOOK, 0);
+         if(arrayref != NULL) {
+           array = (AV*) SvRV(*arrayref);
+           SvREFCNT_inc((SV*) array);
+           for(i = 0; i <= (int) av_len(array); i++) {
+             arrayval = av_fetch(array,(I32) i,0);
  
!             if(arrayval != NULL) {
!               perlsub = *arrayval;
!               SvREFCNT_inc(perlsub);
!               dSP;
!               ENTER;
!               SAVETMPS;
!               PUSHMARK(SP);
!                 XPUSHs(perlud->svSelf);
!                 XPUSHs(sv_2mortal(newSViv(pmsg->message)));
!                 XPUSHs(sv_2mortal(newSViv(pmsg->wParam)));
!                 XPUSHs(sv_2mortal(newSViv(pmsg->lParam)));
!               PUTBACK;
  
!               count = call_sv(perlsub, G_ARRAY|G_EVAL);
!               SPAGAIN;
  
!               if(SvTRUE(ERRSV)) {
!                 ProcessEventError(NOTXSCALL 
"TrackPopupMenu(WindowsHookMsgProc)", &PerlResult);
!               } else {
!                 if(count > 0) { PerlResult = POPi; }
!               }
  
!               PUTBACK;
!               FREETMPS;
!               LEAVE;
!               SvREFCNT_dec(perlsub);
              }
            }
!           SvREFCNT_dec((SV*) array);
  
!           // PerlResult = 0: do not pass event to rest of chain or target 
windows procedure
!           // PerlResult = -1: as 0, and terminate application
!           // PerlResult = anything else, pass event on
!           if(PerlResult == 0) {
!             return 1;  // stops message being passed along hook chain and to 
target windows procedure
!           } else if (PerlResult == -1) {
!             //send a WM_CANCELMODE to get menu to close
!             SendMessage(pmsg->hwnd, WM_CANCELMODE, 0, 0);
!             //post a message to get the main loop to exit
!             PostMessage(pmsg->hwnd, WM_EXITLOOP, (WPARAM) -1, 0);
!             return 1;  // stops message being passed along hook chain and to 
target windows procedure
!           }
          }
        }

Index: CHANGELOG
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v
retrieving revision 1.146
retrieving revision 1.147
diff -C2 -d -r1.146 -r1.147
*** CHANGELOG   13 Feb 2008 15:24:04 -0000      1.146
--- CHANGELOG   20 Feb 2010 12:22:27 -0000      1.147
***************
*** 6,9 ****
--- 6,12 ----
  Win32-GUI ChangeLog
  ===================
+ + [Jeremy White] : 20 February 2010 - Bug fix
+    - GUI_Helpers.cpp fix of bug #1941264 causing crash with menus
+ 
  + [Robert May] : 13 February 2008 - 1.06 Release
      - Up version numbers to 1.06


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Perl-win32-gui-cvscommit mailing list
Perl-win32-gui-cvscommit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-cvscommit
http://perl-win32-gui.sourceforge.net/

Reply via email to