GNU bug report logs - #451
23.0.60; x-gtk-map-stock destroys match data

Previous Next

Package: emacs;

Reported by: Nick Roberts <nickrob <at> snap.net.nz>

Date: Fri, 20 Jun 2008 03:50:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nick Roberts <nickrob <at> snap.net.nz>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 451 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: bug#451: 23.0.60; x-gtk-map-stock destroys match data
Date: Sat, 21 Jun 2008 11:01:17 +1200
 > > In the event loop (?), update_frame_tool_bar calls x-gtk-map-stock (in
 > > x-win.el) which uses string-match.  This changes the match data that
 > > I need for my application.  I don't know what the rules are about
 > > using string-match from C code but as a minimum x-gtk-map-stock should
 > > wrap save-match-data around the call to it.
 > 
 > The match-data is a very volatile piece of data.  So while you may be
 > right, I think it's more likely that the problem is in your code
 > (i.e., your code should save the match-data itself if it needs to use
 > it after some non-trivial code has been run, and by "trivial" I *really*
 > mean trivial).

I don't think that's right.  The problem goes away if I remove the tool bar.
If I do:

(string-match "ox" "The quick lazy fox jumped")

in the *scratch* buffer then

(match-beginning 0)
(match-end 0)

give me false values immediately afterwards.

Presumably update_frame_tool_bar gets called in between the evaluations.  I'm
not sure exactly why it's called but I have:

(add-hook 'gdb-mode-hook
'(lambda ()
   (tool-bar-mode 1)
   (if (eq window-system 'x)
       (define-key-after gud-tool-bar-map [function-step]
	 '(menu-item "Step outer" gud-function-step
		     :image (image :type xpm
		     :file "/home/nickrob/emacs/etc/images/jump-to.xpm")
		     :enable (not gud-running)
		     :visible (memq gud-minor-mode '(gdbmi gdba)))))))

in my .emacs


-- 
Nick                                           http://www.inet.net.nz/~nickrob




This bug report was last modified 16 years and 338 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.