GTK program (a Gimp plugin) crashes only on Windows



Hello everyone, I'm facing a problem with the development of a plug-in for The Gimp program. I'm writing here because it uses GTK libs and, actually, the problem regards a crash of a GTK widget.

The plug-in is composed of a main window and several pop-ups. One of those smaller dialogs has a GtkFrame (frame_params) with a GtkScrolledWindow (frame_scroll) in it, that changes its inner widget when the user chooses from a list of items.
The alteration of the contents is intended as a procedure like this:

1) User chooses one of the selectable items
2) A GtkTable is initialized with a variable number of row, depending on the selection. 2/a) In a loop, each table row is filled with some widgets. In particular, possible items in the table can be GtkComboBox, GtkEntry, GtkColorButton or GtkSpinButton. 3) Critical point: the GtkScrolledWindow child need to be replaced, so I destroy it with a function like this:

if (gtk_bin_get_child(GTK_BIN(frame_scroll)) != NULL) {
     GtkWidget* prev_content = gtk_bin_get_child(GTK_BIN(frame_scroll));
if (prev_content != NULL) gtk_widget_destroy(GTK_WIDGET(prev_content));
}

4) Then, the widget is filled again with the new GtkTable (with a viewport to make it scrollable):

gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(frame_scroll), widget); /* 'widget' is the GtkTable */ gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(frame_scroll))), GTK_SHADOW_NONE);
gtk_widget_show_all(frame_params);


I worked with this code for days on Linux, and I never had problems. Now I tried to compile the plug-in for Win32, with MinGW and this command:

gcc -o dist/win32/myplugin.exe -Wall -Wno-unused-variable -Wno-pointer-sign -Wno-parentheses src/*.c -LC:/MinGW/lib -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -mms-bitfields -mwindows -IC:/MinGW/include/gimp-2.0 -IC:/MinGW/include/gtk-2.0 -IC:/MinGW/include/glib-2.0 -IC:/MinGW/lib/glib-2.0/include -IC:/MinGW/lib/gtk-2.0/include -IC:/MinGW/include/atk-1.0 -IC:/MinGW/include/cairo -IC:/MinGW/include/gdk-pixbuf-2.0 -IC:/MinGW/include/pango-1.0 -IC:/MinGW/include -IC:/MinGW/include/freetype2 -IC:/MinGW/include/libpng14 -DGIMP_DISABLE_DEPRECATED

Compiler finishes and I can run the plug-in under Gimp (2.6.12) for Windows (7, 64bits). But the whole program fails when the GtkFrame gets updated... apparently, randomly. I mean that "sometimes" its children gets updated and I can see the changes, but most of the times Windows show this crash report:

Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    myplugin.exe
  Application Version:    0.0.0.0
  Application Timestamp:    4f9439e7
  Fault Module Name:    ntdll.dll
  Fault Module Version:    6.1.7601.17514
  Fault Module Timestamp:    4ce7ba58
  Exception Code:    c0000005
  Exception Offset:    0002e3fb
  OS Version:    6.1.7601.2.1.0.256.48
  Locale ID:    1040
  Additional Information 1:    7762
  Additional Information 2:    7762d8ef1208577c892420da9a4606c1
  Additional Information 3:    2927
  Additional Information 4:    29275559520e0b78c2d9e8e9b3f4798b


What could be the problem? Is that a good way to update the GtkFrame + GtkScrollableWindow contents? Or is it a problem related to compiling arguments/libraries?
Thank you.
Ale



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