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 537120 - Windows ListViewText crash
Windows ListViewText crash
Status: RESOLVED INCOMPLETE
Product: gtkmm
Classification: Bindings
Component: TreeView
2.4
Other All
: Normal critical
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-06-07 14:33 UTC by K Civilian
Modified: 2008-11-14 09:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description K Civilian 2008-06-07 14:33:06 UTC
Please describe the problem:

I tried adding a ListViewText widget to my window. Everything works great except when the application quits. When I close the window, the program crashes. Crash location is a code block in gtkmm-2.4.dll. If I comment out the ListViewText lines it works fine but as soon as I add ListViewText, it'd crash on exit.



Steps to reproduce:
Hers is my code:

#include <gtkmm.h>

#pragma comment(lib, "glibmm-2.4.lib")
#pragma comment(lib, "gtkmm-2.4.lib")
#pragma comment(lib, "sigc-2.0.lib")
#pragma comment(lib, "atkmm-1.6.lib")

#include <windows.h>

using namespace Gtk;

#define LABELCTRL(N, L) class N##Label: public Label { public: N##Label():Label(L) {}} N;
#define TABLEATTACHSPAN(ROW, COL, ROWSPAN, COLSPAN, ITEM) attach(ITEM, ROW-1, ROW - 1 + ROWSPAN, COL-1, COL - 1 + COLSPAN);
#define TABLEATTACH(ROW, COL, ITEM) TABLEATTACHSPAN(ROW, COL, 1, 1, ITEM)

class MainWindow: public Window {
public:
	class MainLayout: public Table {

	public:
		LABELCTRL(lblUsername, "User name");
		LABELCTRL(lblIP, "IP");
		LABELCTRL(lblQuitMessage, "Quit Message");
		LABELCTRL(lblConnectionSetting, "Connection setting");
		LABELCTRL(lblPort, "Port");
		LABELCTRL(lblOptions, "Option");

		Entry entUsername;
		ComboBox cmbConnectionSetting;
		Entry entQuitMessage;
		Entry entPort;
		ComboBox cmbOptions;


		class IPEntryHbox: public HBox {
		public:
			Entry entIP;

			class btnConnectButton: public Button {

			public:
				btnConnectButton() : Button("Connect") {
					//set_size_request(1, 1);
				}
				
				bool on_button_press_event(GdkEventButton*) {
					return true;
				}

			} btnConnect;

			IPEntryHbox() : HBox(false) {
				pack_start(entIP);
				pack_end(btnConnect);
			}
		} ipInput;


		class serversListListViewText : public ListViewText {
		public:
			serversListListViewText() : ListViewText(2, false) {
				//set_column_title(0, "Server");
				//set_column_title(1, "IP");

				//set_size_request(400, 250);

				//insert_text(0, "asdf");
				//set_text(0, 1, "asdasdasda");
				
			}
			~serversListListViewText(){
				MessageBox(0,0,0,0);
			}
		} serversList;

	public:
		
		LABELCTRL(lblStored, "Stored");

		MainLayout():Table(10, 2, false) {
			TABLEATTACH(1, 1, lblUsername);
			TABLEATTACH(1, 2, lblIP);
			TABLEATTACH(1, 3, lblStored);
			TABLEATTACH(1, 4, lblQuitMessage);
			TABLEATTACH(1, 5, lblConnectionSetting);
			TABLEATTACH(1, 6, lblPort);
			TABLEATTACH(1, 7, lblOptions);

			TABLEATTACH(2, 1, entUsername);
			TABLEATTACH(2, 2, ipInput);
			TABLEATTACH(2, 3, serversList);
			TABLEATTACH(2, 4, entQuitMessage);
			TABLEATTACH(2, 5, cmbConnectionSetting);
			TABLEATTACH(2, 6, entPort);
			TABLEATTACH(2, 7, cmbOptions);

			//lblIP.set_size_request(100, 20);
		}
	} controls;

	//class: public Button {bool on_button_press_event(GdkEventButton * ) {Main::quit(); return false;}} btnExit;


	MainWindow() {
		//set_size_request(750, 550);
		add(controls);
		show_all();
	}

};

...

Main kit(&argc, (char ***) &args);
MainWindow mainWindow;
Main::run(mainWindow);


Actual results:
crashes on exit

Expected results:
expected it to quit peacefully

Does this happen every time?
yes

Other information:
Comment 1 K Civilian 2008-06-07 14:39:14 UTC
as you can see, I've put in a destructor for ListViewText child class and the message box does show up. it crashes after the messagebox is gone. It'd crash even if I have something like:

ListViewText serversList(2);

in a function
Comment 2 Murray Cumming 2008-06-10 06:49:40 UTC
> It'd crash even if I have something like:
> ListViewText serversList(2);

So please do provide a simpler test case.
Comment 3 K Civilian 2008-06-10 18:39:36 UTC
something like this I guess?:

#include <gtkmm.h>

#pragma comment(lib, "glibmm-2.4.lib")
#pragma comment(lib, "gtkmm-2.4.lib")
#pragma comment(lib, "sigc-2.0.lib")
#pragma comment(lib, "atkmm-1.6.lib")

int main( int argc, char *args[])
{
	Main kit(&argc, &args);
	ListViewText serversList(2);
	return 0;
}
Comment 4 Murray Cumming 2008-08-04 11:08:33 UTC
You guess? Are you sure? Please try that test case.
Comment 5 K Civilian 2008-08-04 11:45:36 UTC
Yes I'm sure it crashed when I tried. Some of have time constraints for our projects to be held back by one stupid bug and we've moved onto other packages. Thanks for your time. Good luck with gtkmm.
Comment 6 Armin Burgmeier 2008-08-09 18:08:42 UTC
I guess there is "using namespace Gtk;" missing in your test, otherwise it does not compile. Anyway, I could not reproduce the problem with neither gcc nor MSVC. 

When using MSVC, make sure you link against the correct libraries and use the correct Run-Time: For a debug build, use "Multi-Threaded Debug" as "Runtime Library", and link against the libraries ending on "d", such as "gtkmm-2.4d.lib". For the release build, use "Multi-Threaded", and link against the libraries without "d" (gtkmm-2.4.lib). I don't know whether that's the problem here, but doing it wrong can result in seemingly random crashes.
Comment 7 Murray Cumming 2008-10-20 11:24:55 UTC
K Civilian, please respond, and please provide a compileable test case if you still have this problem.
Comment 8 Murray Cumming 2008-11-10 12:35:49 UTC
Please respond.
Comment 9 Murray Cumming 2008-11-14 09:19:10 UTC
Closing due to lack of response.