Skip to content

Commit 58363bb

Browse files
committed
fix ^Q
1 parent 7cfeb17 commit 58363bb

File tree

4 files changed

+44
-38
lines changed

4 files changed

+44
-38
lines changed

TODO

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
1-
- start, ^Q,
1+
- close wsg on removal of final tab
22

3-
==10270== Invalid read of size 8
4-
==10270== at 0x457A65: filemodel_set_modified (filemodel.c:118)
5-
==10270== by 0x45914C: filemodel_inter_empty_cb (filemodel.c:747)
6-
==10270== by 0x459343: filemodel_inter_savenempty_cb (filemodel.c:792)
7-
==10270== by 0x459447: filemodel_inter_savenclose_cb (filemodel.c:823)
8-
==10270== by 0x459893: filemodel_inter_close_registered_cb (filemodel.c:925)
9-
==10270== by 0x4870D5: iwindow_susp_comp (iwindow.c:435)
10-
==10270== by 0x4593ED: filemodel_inter_close_cb (filemodel.c:813)
11-
==10270== by 0x4870D5: iwindow_susp_comp (iwindow.c:435)
12-
==10270== by 0x45915E: filemodel_inter_empty_cb (filemodel.c:749)
13-
==10270== by 0x459343: filemodel_inter_savenempty_cb (filemodel.c:792)
14-
==10270== by 0x459447: filemodel_inter_savenclose_cb (filemodel.c:823)
15-
==10270== by 0x459893: filemodel_inter_close_registered_cb (filemodel.c:925)
16-
==10270== Address 0x158 is not stack'd, malloc'd or (recently) free'd
3+
can't do automatically, eg. on page_remove, since that path is run during
4+
saveandquit
175

18-
unreffing wsg too early?
19-
20-
21-
22-
- tiny ws, save-as, quit,
23-
24-
[Thread 0x7fffd233b700 (LWP 12489) exited]
25-
(nip2:12480): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)'
26-
in
27-
cast to `Filemodel'
6+
do check as part of response to user action, wg. rioght-click / delete, or
7+
^W
288

9+
don't offer to save, since the wsg is empty
2910

3011
- drag tabs between windows still sometimes crashes
3112

src/mainw.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,6 @@ static void
19231923
mainw_wsg_changed_cb( Workspacegroup *wsg, Mainw *mainw )
19241924
{
19251925
mainw_refresh( mainw );
1926-
1927-
if( mainw->wsg &&
1928-
!ICONTAINER( mainw->wsg )->children )
1929-
iwindow_kill( IWINDOW( mainw ) );
19301926
}
19311927

19321928
static void

src/workspacegroup.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,31 @@ workspacegroup_dispose( GObject *gobject )
121121
wsg = WORKSPACEGROUP( gobject );
122122

123123
#ifdef DEBUG
124-
printf( "workspacegroup_dispose %s\n", IOBJECT( wsg )->name );
125124
#endif /*DEBUG*/
125+
printf( "workspacegroup_dispose %s\n", IOBJECT( wsg )->name );
126126

127127
IM_FREEF( g_source_remove, wsg->autosave_timeout );
128-
icontainer_map( ICONTAINER( wsg ),
129-
(icontainer_map_fn) icontainer_child_remove, NULL, NULL );
130128

131129
G_OBJECT_CLASS( parent_class )->dispose( gobject );
132130
}
133131

132+
static void
133+
workspacegroup_finalize( GObject *gobject )
134+
{
135+
Workspacegroup *wsg;
136+
137+
g_return_if_fail( gobject != NULL );
138+
g_return_if_fail( IS_WORKSPACEGROUP( gobject ) );
139+
140+
wsg = WORKSPACEGROUP( gobject );
141+
142+
#ifdef DEBUG
143+
#endif /*DEBUG*/
144+
printf( "workspacegroup_finalize %s\n", IOBJECT( wsg )->name );
145+
146+
G_OBJECT_CLASS( parent_class )->finalize( gobject );
147+
}
148+
134149
static View *
135150
workspacegroup_view_new( Model *model, View *parent )
136151
{
@@ -711,6 +726,7 @@ workspacegroup_class_init( WorkspacegroupClass *class )
711726
/* Init methods.
712727
*/
713728
gobject_class->dispose = workspacegroup_dispose;
729+
gobject_class->finalize = workspacegroup_finalize;
714730

715731
iobject_class->user_name = _( "Workspace" );
716732

src/workspacegroupview.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@
3535

3636
static ViewClass *parent_class = NULL;
3737

38+
static void
39+
workspacegroupview_dispose( GObject *gobject )
40+
{
41+
Workspace *ws;
42+
43+
#ifdef DEBUG
44+
printf( "workspacegroupview_dispose:\n" );
45+
#endif /*DEBUG*/
46+
47+
g_return_if_fail( gobject != NULL );
48+
g_return_if_fail( IS_WORKSPACEGROUPVIEW( gobject ) );
49+
50+
G_OBJECT_CLASS( parent_class )->dispose( gobject );
51+
}
52+
3853
static void
3954
workspacegroupview_realize( GtkWidget *widget )
4055
{
@@ -147,12 +162,15 @@ workspacegroupview_refresh( vObject *vobject )
147162
static void
148163
workspacegroupview_class_init( WorkspacegroupviewClass *class )
149164
{
165+
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
150166
GtkWidgetClass *widget_class = (GtkWidgetClass *) class;
151167
vObjectClass *vobject_class = (vObjectClass *) class;
152168
ViewClass *view_class = (ViewClass *) class;
153169

154170
parent_class = g_type_class_peek_parent( class );
155171

172+
gobject_class->dispose = workspacegroupview_dispose;
173+
156174
widget_class->realize = workspacegroupview_realize;
157175

158176
vobject_class->refresh = workspacegroupview_refresh;
@@ -260,16 +278,11 @@ workspacegroupview_page_removed_cb( GtkNotebook *notebook,
260278
Mainw *mainw = MAINW( iwindow_get_root( GTK_WIDGET( notebook ) ) );
261279

262280
/*
281+
*/
263282
Workspace *ws = WORKSPACE( VOBJECT( wview )->iobject );
264283

265284
printf( "workspacegroupview_page_removed_cb: wsg = %s, ws = %s\n",
266285
NN( IOBJECT( wsg )->name ), NN( IOBJECT( ws )->name ) );
267-
*/
268-
269-
if( icontainer_get_n_children( ICONTAINER( wsg ) ) == 0 ) {
270-
//printf( "workspacegroupview_page_removed_cb: killing mainw\n" );
271-
iwindow_kill( IWINDOW( mainw ) );
272-
}
273286
}
274287

275288
static void

0 commit comments

Comments
 (0)