[Pidgin] #11431: Signals no longer work in Perl plugins

Pidgin trac at pidgin.im
Thu Feb 25 15:48:18 EST 2010


#11431: Signals no longer work in Perl plugins
----------------------+-----------------------------------------------------
 Reporter:  dharding  |        Owner:  MarkDoliner
     Type:  defect    |       Status:  new        
Milestone:  2.7.0     |    Component:  plugins    
  Version:  2.6.6     |   Resolution:             
 Keywords:  perl      |  
----------------------+-----------------------------------------------------

Comment(by dharding):

 The root problem is that va_list is an array type on some platforms, which
 causes problems when trying to have a va_list* parameter for a function.
 Yet on other platforms va_list is a pointer, which we want to be modified
 by a called function in such a way that the caller sees the modification.
 Thus on these platforms passing it by value doesn't work - we need pass by
 reference.  I have attached a patch which I think may provide a solution
 without requiring messy #ifdefs around the function prototype.  I created
 a struct, va_list_wrapper, which simply has one member, a va_list.
 purple_perl_sv_from_vargs now takes a va_list_wrapper* in place of a
 va_list or va_list*, allowing it to mutate the caller's copy of the
 struct.  The caller, perl_signal_cb, creates a va_list_wrapper struct on
 the stack and uses the G_VA_COPY macro to copy the args va_list into that
 struct before calling purple_perl_sv_from_vargs.  Not the prettiest
 perhaps, but the best I have been able to come up with so far without
 resorting to #ifdefs.  Tested successfully on mingw/x86.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/11431#comment:5>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list