Merge lp:~alan-griffiths/compiz-core/Bug-931283 into lp:compiz-core

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 3000
Merged at revision: 2998
Proposed branch: lp:~alan-griffiths/compiz-core/Bug-931283
Merge into: lp:compiz-core
Diff against target: 63 lines (+14/-13)
1 file modified
src/screen.cpp (+14/-13)
To merge this branch: bzr merge lp:~alan-griffiths/compiz-core/Bug-931283
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Sam Spilsbury Approve
Review via email: mp+92731@code.launchpad.net

Description of the change

Fix teardown sequence

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

This *might* also fix the hang on "--replace" that Sam mentioned on chat. (Not sure how to reproduce that.)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Using this fix, now it crashes in opengl shutdown instead. But the stacks are similar to the original bug...

==14834== Invalid read of size 8
==14834== at 0x9E59307: OpenglPluginVTable::fini() (opengl.cpp:99)
==14834== by 0x4E9F3BD: CompPlugin::pop() (plugin.cpp:524)
==14834== by 0x4E6B913: PrivateScreen::~PrivateScreen() (screen.cpp:5021)
==14834== by 0x4E6C0B8: PrivateScreen::~PrivateScreen() (screen.cpp:5040)
==14834== by 0x4E68041: CompScreenImpl::~CompScreenImpl() (checked_delete.hpp:34)
==14834== by 0x4E681A8: CompScreenImpl::~CompScreenImpl() (screen.cpp:4930)
==14834== by 0x402CC2: CompManager::fini() (main.cpp:214)
==14834== by 0x4029A5: main (main.cpp:239)
==14834== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==14834==
==14834==
==14834== Process terminating with default action of signal 11 (SIGSEGV)
==14834== Access not within mapped region at address 0x0
==14834== at 0x9E59307: OpenglPluginVTable::fini() (opengl.cpp:99)
==14834== by 0x4E9F3BD: CompPlugin::pop() (plugin.cpp:524)
==14834== by 0x4E6B913: PrivateScreen::~PrivateScreen() (screen.cpp:5021)
==14834== by 0x4E6C0B8: PrivateScreen::~PrivateScreen() (screen.cpp:5040)
==14834== by 0x4E68041: CompScreenImpl::~CompScreenImpl() (checked_delete.hpp:34)
==14834== by 0x4E681A8: CompScreenImpl::~CompScreenImpl() (screen.cpp:4930)
==14834== by 0x402CC2: CompManager::fini() (main.cpp:214)
==14834== by 0x4029A5: main (main.cpp:239)
==14834== If you believe this happened as a result of a stack
==14834== overflow in your program's main thread (unlikely but
==14834== possible), you can try to increase the size of the
==14834== main thread stack using the --main-stacksize= flag.
==14834== The main thread stack size used in this run was 8388608.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Didn't see that - will look harder.

2999. By Alan Griffiths

Fix teardown sequence

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Reproduced opengl problem and fixed.

3000. By Alan Griffiths

Fix invalid memory read reported by valgrind

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

The code looks fine - if this is shutting down cleanly, please merge it alan.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Confirmed. All the crashes are fixed in revision 3000. Valgrind is happy.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/screen.cpp'
2--- src/screen.cpp 2012-02-13 08:15:12 +0000
3+++ src/screen.cpp 2012-02-13 11:56:23 +0000
4@@ -4660,8 +4660,8 @@
5 compScreenSnEvent, this, NULL);
6
7 wmSnSelectionWindow = newWmSnOwner;
8- wmSnAtom = wmSnAtom;
9- wmSnTimestamp = wmSnTimestamp;
10+ this->wmSnAtom = wmSnAtom;
11+ this->wmSnTimestamp = wmSnTimestamp;
12
13 if (!XGetWindowAttributes (dpy, root, &attrib))
14 return false;
15@@ -4921,6 +4921,14 @@
16
17 CompScreenImpl::~CompScreenImpl ()
18 {
19+ priv->removeAllSequences ();
20+
21+ while (!priv->windows.empty ())
22+ delete priv->windows.front ();
23+
24+ while (CompPlugin* p = CompPlugin::pop ())
25+ CompPlugin::unload (p);
26+
27 screen = NULL;
28 }
29
30@@ -4996,11 +5004,6 @@
31 {
32 if (initialized)
33 {
34- removeAllSequences ();
35-
36- while (!windows.empty ())
37- delete windows.front ();
38-
39 XUngrabKey (dpy, AnyKey, AnyModifier, root);
40
41 initialized = false;
42@@ -5015,18 +5018,16 @@
43
44 XFreeCursor (dpy, invisibleCursor);
45 XSync (dpy, False);
46+
47+ if (snContext)
48+ sn_monitor_context_unref (snContext);
49+
50 XCloseDisplay (dpy);
51 }
52
53- while (CompPlugin* p = CompPlugin::pop ())
54- CompPlugin::unload (p);
55-
56 if (desktopHintData)
57 free (desktopHintData);
58
59- if (snContext)
60- sn_monitor_context_unref (snContext);
61-
62 if (snDisplay)
63 sn_display_unref (snDisplay);
64

Subscribers

People subscribed via source and target branches