This might be obvious to some, but it wasn't to me.
If you are hacking on vcl, for Windows, do not add MessageBox() calls. (You
might want to do it either to get debugging output more visible than a
SAL_DEBUG(), or to make the execution pause until you press the OK button
so that you have time to attach the process in Visual Studio, for instance.)
MessageBox() runs its own message loop, and for some reason that will cause
our SalComWndProcW() window procedure to be called, and that might cause
timers to fire, and the code timers invoke might have fun side effects.
For instance, zeroing out the mpGraphics member of a Window object. (See
the "// steal the wingraphics from the other outdev" code in
Window::AcquireGraphics().)
This will wreak havoc on code that otherwise works fine as soon as you
comment out the MessageBox() call and let it run at its normal pace.
Instead, if you need to make execution stop at some point until you have
time to attach the debugger, for instance use some "volatile int foo=1;
while (foo);" type of thing, and once you have the process attached, break
it, set foo to zero, and continue. Or Sleep(10000). Etc.
--tml
Context
- Advice: Don't use MessageBox() for temporary debugging output or pausing · Tor Lillqvist
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.