bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs hangs in c++ font-lock-mode


From: Dirk Farin
Subject: emacs hangs in c++ font-lock-mode
Date: Thu, 14 Apr 2005 12:24:51 +0200
User-agent: Debian Thunderbird 1.0 (X11/20050116)


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

#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;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]