all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs hangs in c++ font-lock-mode
@ 2005-04-14 10:24 Dirk Farin
  0 siblings, 0 replies; 2+ messages in thread
From: Dirk Farin @ 2005-04-14 10:24 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 324 bytes --]


Hi,

I have got a C++ source file that causes "GNU Emacs 21.4.1"
(current Debian testing) to hang with 100% cpu. To reproduce
the bug, load the attached source file and turn font-lock-mode
on in C++ mode. If you move the cursor down, at some position,
emacs will hang and accept no more keyboard inputs.

Regards,
   Dirk


[-- Attachment #2: main.cc --]
[-- Type: text/x-c++src, Size: 2829 bytes --]


#include <gtkmm.h>
#include <libgnomeuimm.h>
#include <libgnomemm.h>
#include <libglademm.h>
#include <iostream>
#include <libvideogfx.hh>

using namespace videogfx;
//using namespace std;

Glib::RefPtr<Gnome::Glade::Xml> refXml;
Gnome::UI::App* pApp = 0;  // main window


struct SourceImage
{
  std::string name;
  Image<Pixel>  img;
};

DynArray<SourceImage> g_images;


void on_menu_item_activated()
{
  std::cout << "add\n";
}


void AddImageToList()
{
  Gtk::FileChooserDialog dialog("Please choose an image", Gtk::FILE_CHOOSER_ACTION_OPEN);
  dialog.set_transient_for(*pApp);

  //Add response buttons the the dialog:
  dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);

  //Add filters, so that only certain file types can be selected:

#if 0
  Gtk::FileFilter filter_text;
  filter_text.set_name("Text files");
  filter_text.add_mime_type("text/plain");
  dialog.add_filter(filter_text);

  Gtk::FileFilter filter_cpp;
  filter_cpp.set_name("C/C++ files");
  filter_cpp.add_mime_type("text/x-c");
  filter_cpp.add_mime_type("text/x-c++");
  filter_cpp.add_mime_type("text/x-c-header");
  dialog.add_filter(filter_cpp);
#endif

#if 0
  Gtk::FileFilter filter_any;
  filter_any.set_name("Any files");
  filter_any.add_pattern("*");
  dialog.add_filter(filter_any);
#endif

  //Show the dialog and wait for a user response:
  int result = dialog.run();

  //Handle the response:
  switch(result)
    {
    case(Gtk::RESPONSE_OK):
      {
	std::cout << "Open clicked." << std::endl;

	std::string filename = dialog.get_filename(); //Notice that it is a std::string, not a Glib::ustring.
	std::cout << "File selected: " <<  filename << std::endl;

	int last = filename.find_last_of('/');

	SourceImage newimage;
	newimage.name = filename.substr(

	//std::cout << last << endl;

#if 0
struct SourceImage
{
  Glib::ustring name;
  Image<Pixel>  img;
};

DynArray<SourceImage> g_images;
#endif

	break;
      }
    case(Gtk::RESPONSE_CANCEL):
      {
	std::cout << "Cancel clicked." << std::endl;
	break;
      }
    default:
      {
	std::cout << "Unexpected button clicked." << std::endl;
	break;
      }
    }
}


void ConnectMenuCallbacks()
{
  Gtk::MenuItem* pMenuItem = 0;
  refXml->get_widget("add_image1", pMenuItem);
  if(pMenuItem)
    pMenuItem->signal_activate().connect( sigc::ptr_fun(&AddImageToList) );

  refXml->get_widget("quit1", pMenuItem);
  if(pMenuItem)
    pMenuItem->signal_activate().connect( sigc::mem_fun(*pApp,&Gnome::UI::App::hide) );
}


int main(int argc, char *argv[])
{
  Gnome::Main kit("spherepano","0.1",
		  Gnome::UI::module_info_get(),
		  argc,argv);

  refXml = Gnome::Glade::Xml::create("gui.glade");

  refXml->get_widget("mainwindow", pApp);

  ConnectMenuCallbacks();

  Gtk::Main::run(*pApp);
    
  return 0;
}

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: emacs hangs in c++ font-lock-mode
  2005-04-16 16:50 emacs hangs in c++ font-lock-modeo Alan Mackenzie
@ 2005-04-16 17:34 ` Dirk Farin
  0 siblings, 0 replies; 2+ messages in thread
From: Dirk Farin @ 2005-04-16 17:34 UTC (permalink / raw)
  Cc: bug-cc-mode, bug-gnu-emacs


First the good news: the problem does not appear anymore in the current
Emacs CVS version 22.0.50 (with cc-mode 5.30.9).

>>I have got a C++ source file that causes "GNU Emacs 21.4.1" (current Debian
>>testing) to hang with 100% cpu. To reproduce the bug, load the attached
>>source file and turn font-lock-mode on in C++ mode. If you move the cursor
>>down, at some position, emacs will hang and accept no more keyboard inputs.
> 
> I know that everything will still be set up to their defaults, but could
> you perhaps give us some more details just the same:
> 
> How powerful is your computer?  (Processor speed in MHz or GHz).

2.6 GHz, x86, but I tested on a variety of different systems with the
same result.

> What version of CC Mode have you got?  (M-x c-version)

"Using CC Mode version 5.28"

> Did you start your session with "emacs -q --no-site-file"?  (I.e. without
> your .emacs and any site-lisp.el loaded.)  If not, do you still get the
> problem when you do?

Does not change anything.

> Does Emacs _always_ hang up, _usually_ hang up or _sometimes_ hang up?

always

> How long does it take after loading the file before it hangs?  Does it
> free up if you leave it running 8 or 12 hours or more?

It occurs immediately. Start a new emacs, load the provided source code,
scroll down and it hangs.
I didn't check for several hours, but it stays locked for at least
10 minutes without increasing memory consumption.

> What support mode are you using in font lock?  (C-h v
> font-lock-support-mode).  Probably jit-lock-mode, the default.  Does the
> problem go away if you use lazy lock instead?  (Do M-: (setq

Yes, it it jit-lock-mode. If I switch to lazy mode, it locks already
while loading the file. Last message before it dies:
   "Fontifying emacs_hang.cc... (regexps...............)"





> [OT good news:  My city council has just decided to use Debian as the
> replacement for MS-Windows on its several thousand desktop PCs.  They're
> hoping to start rolling it out at the end of this year.  :-]

Ja, schoen. Habe ich auch gerade in den DLF Nachrichten gehoert.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-16 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-14 10:24 emacs hangs in c++ font-lock-mode Dirk Farin
  -- strict thread matches above, loose matches on Subject: below --
2005-04-16 16:50 emacs hangs in c++ font-lock-modeo Alan Mackenzie
2005-04-16 17:34 ` emacs hangs in c++ font-lock-mode Dirk Farin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.