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
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2012-02-13 08:15:12 +0000
+++ src/screen.cpp 2012-02-13 11:56:23 +0000
@@ -4660,8 +4660,8 @@
4660 compScreenSnEvent, this, NULL);4660 compScreenSnEvent, this, NULL);
46614661
4662 wmSnSelectionWindow = newWmSnOwner;4662 wmSnSelectionWindow = newWmSnOwner;
4663 wmSnAtom = wmSnAtom;4663 this->wmSnAtom = wmSnAtom;
4664 wmSnTimestamp = wmSnTimestamp;4664 this->wmSnTimestamp = wmSnTimestamp;
46654665
4666 if (!XGetWindowAttributes (dpy, root, &attrib))4666 if (!XGetWindowAttributes (dpy, root, &attrib))
4667 return false;4667 return false;
@@ -4921,6 +4921,14 @@
49214921
4922CompScreenImpl::~CompScreenImpl ()4922CompScreenImpl::~CompScreenImpl ()
4923{4923{
4924 priv->removeAllSequences ();
4925
4926 while (!priv->windows.empty ())
4927 delete priv->windows.front ();
4928
4929 while (CompPlugin* p = CompPlugin::pop ())
4930 CompPlugin::unload (p);
4931
4924 screen = NULL;4932 screen = NULL;
4925}4933}
49264934
@@ -4996,11 +5004,6 @@
4996{5004{
4997 if (initialized)5005 if (initialized)
4998 {5006 {
4999 removeAllSequences ();
5000
5001 while (!windows.empty ())
5002 delete windows.front ();
5003
5004 XUngrabKey (dpy, AnyKey, AnyModifier, root);5007 XUngrabKey (dpy, AnyKey, AnyModifier, root);
50055008
5006 initialized = false;5009 initialized = false;
@@ -5015,18 +5018,16 @@
50155018
5016 XFreeCursor (dpy, invisibleCursor);5019 XFreeCursor (dpy, invisibleCursor);
5017 XSync (dpy, False);5020 XSync (dpy, False);
5021
5022 if (snContext)
5023 sn_monitor_context_unref (snContext);
5024
5018 XCloseDisplay (dpy);5025 XCloseDisplay (dpy);
5019 }5026 }
50205027
5021 while (CompPlugin* p = CompPlugin::pop ())
5022 CompPlugin::unload (p);
5023
5024 if (desktopHintData)5028 if (desktopHintData)
5025 free (desktopHintData);5029 free (desktopHintData);
50265030
5027 if (snContext)
5028 sn_monitor_context_unref (snContext);
5029
5030 if (snDisplay)5031 if (snDisplay)
5031 sn_display_unref (snDisplay);5032 sn_display_unref (snDisplay);
50325033

Subscribers

People subscribed via source and target branches