I am developing a Gtk application using gtkmm on Windows Vista with Visual Studio 2005. The application works fine on the development machine, but I received crash reports after it was run on computers running Windows XP (as with Service Pack 2 and 3) , I am distributing an application with the directory structure described at http://live.gnome.org/gtkmm/MSWindows , and so far this has not given me problems.
The crash does not give error messages, except for Windows asking if I want to report an error.
To solve the problem, I tried to compile the program against different versions of gtkmm (the recent stable version is gtkmm-win32-devel-2.16.0-4 and an older version of gtkmm-win32-devel-2.10.11 -1), but the problem persists.
I searched for the problem before calling window-> create_cairo_context () inside the on_expose_event object from Gtk :: DrawingArea. When I commented on this call, the problem will disappear. So I wrote the following minimal program that still crashes:
#include <gtkmm.h>
#include <iostream>
class MyWindow : public Gtk::Window {
bool on_expose_event(GdkEventExpose* event) {
std::cout << "expose" << std::endl;
Glib::RefPtr<Gdk::Window> window = get_window();
if(window) {
std::cout << "win" << std::endl;
std::cout << "Get cairo" << std::endl;
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
std::cout << "Get cairo done" << std::endl;
} else {
std::cout << "no win" << std::endl;
}
return true;
}
};
int main (int argc, char *argv[]) {
Gtk::Main m(argc,argv);
MyWindow w;
m.run(w);
return 0;
}
, , / ( on_expose_event), . , , , on_expose_event, . , , , "Get cairo done". create_cairo_context, , , - .
Windows XP. ( ) , Windows XP, . , , / , , . DirectX Visual Studio ++ 2005, , .
, DrawingArea, . , .
MinGW, , . . , gdi32.dll - , libcairo-2.dll DLL Dependency Walker, . , .
. , - , .