After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 375009 - Crash while inside a signal handler
Crash while inside a signal handler
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.10.x
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2006-11-14 07:14 UTC by Alexis Wilke
Modified: 2006-11-30 03:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alexis Wilke 2006-11-14 07:14:54 UTC
Steps to reproduce:
We are creating a proprietary application, so we cannot just copy the code here. However, the application works just fine under Linux, it crashes under  Win32 in a timeout callback (our auto-save feature uses a sigc++ signal to receive a callback whenever our timer times out).

This is the setup call and the callback function we use:

...

  Glib::signal_timeout().connect( sigc::mem_fun(*this, &MainWindow::OnTimer), SAVE_TIMEOUT_SECS * 1000 );

...

bool MainWindow::OnTimer()
{
	Save();
	return true;
}

Our main problem is that we needed 2.8 before a pre-compiled version was available and now we need 2.10 before a pre-compiled version is available...

Using the pre-compiled versions has worked (well, it has worked great with 2.8).

I tried to call the Save() by itself under Win32, and the file got saved just fine. So I cannot blame the Save() function itself, and since we can run the App for hours under Linux, there does not seem to be any good reason for this crash other than some incompatible compile (i.e. a structure/object size mismatched between two libraries).

Stack trace:
This varies. So one stack trace would not give you much.

The problem is with memory allocation and as you know where it crashes is just the next new/delete/free/malloc which happen to stumble on the bad memory chunk.

Yet, this only seems to happen in our timeout handler. The rest of our application works just fine.

Other information:
What I can share, no problem, is the source of all the pre-compiled binaries and the source that I have to compile to get everything up to date.

This is what I compile:

	cairomm-1.2.2
	libsigc++-2.0.17
	glibmm-2.12.2
	gtkmm-2.10.2

Everything compiles just fine after I fixed the gtkmm configure script (see bug #371882).

Otherwise, I use the following packages:

  atk-1.12.3.zip
  atk-dev-1.12.3.zip
  cairo-1.2.6.zip
  cairo-dev-1.2.6.zip
  glib-2.12.4.zip
  gtk+-2.10.6.zip
  gtk+-dev-2.10.6.zip
  pango-1.14.5.zip
  pango-dev-1.14.5.zip

These come from different ftp sites.

  ftp://ftp.gnome.org/pub/GNOME/binaries/win32/
  ftp://ftp.gtk.org/pub/gtk/v2.10/win32/

And when available, the mm files are here:

  http://www.pcpm.ucl.ac.be/~gustin/win32_ports/

but at this time I didn't see the gtkmm 2.10.x suite.

Since some people may ask, we tested the code on Celeron's, Pentium 4's and AMD's. Under Linux: fine; under Win32: crash. So I'm sure the problem is some memory management, possibly from some incompatibilities between the different libraries (i.e. glib compiled with different structures than glibmm...)

What I'm after is mainly an insight to search where the bug is. I'll be glad to squish it for you otherwise.
Comment 1 R. Douglas Barbieri 2006-11-14 17:00:43 UTC
Could this be because the Glib::signal_timeout() is emitting from a different thread under Win32 but not Linux? This bug smacks of a multi-thread problem.
Comment 2 Murray Cumming 2006-11-23 14:50:36 UTC
Like any difficult problem, you should probably try to reduce it to a simple test case that you can publish here. That might show the problem in your code, or give us a way to reproduce (and then fix) the problem in gtkmm.
Comment 3 Alexis Wilke 2006-11-24 10:15:49 UTC
I registered bug 378779 in link with the G_OS_WIN32 and G_PLATFORM_WIN32 #define's which don't make it to the /mingw/include/glib folder.

That could be it... but I still need to recompile everything so it may take another day or two to get an answer. If any structure changes depending on these flags, then that's a very bad one.
Comment 4 Alexis Wilke 2006-11-30 03:28:44 UTC
Sorry for the delay... I was compiling the Gtk suite under Win32. It works now. So I have no idea what caused the problem, but I can tell you that any version of a library is just not compatible with another. You need all the right versions of everything to make it work properly. As you are probably already aware.

Since there is no complete list of what is compatible with what, the easiest is just to recompile your own version. That way you know it's all compatible.

Lots of fun 8-)

Okay... so I'm closing this report since it isn't a bug.