Changeset 286


Ignore:
Timestamp:
Apr 23, 2011, 12:54:45 AM (14 years ago)
Author:
dmik
Message:

jdk: Fixed a crash when showing the print dialog in many applications due to jsafe_cast not really expecting non-POD objects with default copy ctors.

Location:
trunk/openjdk/jdk/src/windows
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/jdk/src/windows/javavm/export/jni_md.h

    r278 r286  
    4141#ifdef __cplusplus
    4242
     43inline void jsafe_cast_POD_type_only(...) {}
     44
    4345/* template for safe type casting: the generic version lets the compiler
    4446 * decide (as if no template was used); specific instantiations deal with
    45  * special cases which are guaranteed to be safe */
     47 * special cases which are guaranteed to be safe. Note that it cannot be used
     48 * with non-POD types as otherwise it would implicitly call the copy ctor which
     49 * may have various unwanted side effects */
    4650template<typename TR, typename TS>
    47 inline TR jsafe_cast(TS ts) { return ts; }
     51inline TR jsafe_cast(TS ts) { jsafe_cast_POD_type_only(ts); return ts; }
    4852
    4953#ifdef __EMX__
  • trunk/openjdk/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp

    r278 r286  
    136136
    137137    JavaStringBuffer printerNameBuf(env, printerName);
    138     LPTSTR lpcPrinterName = jsafe_cast<LPTSTR>(printerNameBuf);
     138    LPTSTR lpcPrinterName = printerNameBuf;
    139139    DASSERT(lpcPrinterName != NULL);
    140140
Note: See TracChangeset for help on using the changeset viewer.