src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp
changeset 53338 5afdd1100a20
parent 53180 2a39d5fc7e58
parent 53325 d1ebdef71c73
equal deleted inserted replaced
53305:d193d58ae79d 53338:5afdd1100a20
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    30 #include "AccessBridgeDebug.h"
    30 #include "AccessBridgeDebug.h"
    31 #include "AccessBridgeMessageQueue.h"
    31 #include "AccessBridgeMessageQueue.h"
    32 #include "AccessBridgePackages.h"               // for debugging only
    32 #include "AccessBridgePackages.h"               // for debugging only
    33 #include <windows.h>
    33 #include <windows.h>
    34 #include <malloc.h>
    34 #include <malloc.h>
       
    35 #include <new>
    35 
    36 
    36 DEBUG_CODE(extern HWND theDialogWindow);
    37 DEBUG_CODE(extern HWND theDialogWindow);
    37 extern "C" {
    38 extern "C" {
    38     DEBUG_CODE(void AppendToCallInfo(char *s));
    39     DEBUG_CODE(void AppendToCallInfo(char *s));
    39 }
    40 }
    44 AccessBridgeQueueElement::AccessBridgeQueueElement(char *buf, int size) {
    45 AccessBridgeQueueElement::AccessBridgeQueueElement(char *buf, int size) {
    45     bufsize = size;
    46     bufsize = size;
    46     next = (AccessBridgeQueueElement *) 0;
    47     next = (AccessBridgeQueueElement *) 0;
    47     previous = (AccessBridgeQueueElement *) 0;
    48     previous = (AccessBridgeQueueElement *) 0;
    48     buffer = (char *) malloc(bufsize);
    49     buffer = (char *) malloc(bufsize);
       
    50     if (buffer == NULL) {
       
    51         throw std::bad_alloc();
       
    52     }
    49     memcpy(buffer, buf, bufsize);
    53     memcpy(buffer, buf, bufsize);
    50 }
    54 }
    51 
    55 
    52 AccessBridgeQueueElement::~AccessBridgeQueueElement() {
    56 AccessBridgeQueueElement::~AccessBridgeQueueElement() {
    53     //  delete buffer;
    57     //  delete buffer;